SLComposeViewController erscheint langsam
SLComposeViewController
s dauert 3 bis 4 Sekunden, bis @ angezeigt wird. AberpresentViewController:(UIViewController *) animated:(BOOL) completion:^(void)completion
er @ Methodenabschlussblock wird sofort aufgerufen. Selbst wenn ich eine Ladeanzeige verwende, verschwindet diese blitzschnell. Der zugehörige Code ist unten. Übrigens habe ich @ versucdispatch_async
es hat nicht funktioniert.
Wie kann ich den Prozess beschleunigen?
SLComposeViewController *shareView = [SLComposeViewController composeViewControllerForServiceType: SLServiceTypeFacebook];
[shareView setTitle:@"Title"];
[shareView setInitialText:@"Description"];
[shareView addURL:[NSURL URLWithString:@"http://www.google.com/"]];
[shareView setCompletionHandler:^(SLComposeViewControllerResult result) {
switch (result) {
case SLComposeViewControllerResultCancelled:
{
NSLog(@"Facebook Post Canceled");
break;
}
case SLComposeViewControllerResultDone:
{
NSLog(@"Facebook Post Successful");
break;
}
default:
break;
}
}];
UIActivityIndicatorView *activityView = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];
activityView.center = CGPointMake([UIScreen mainScreen].bounds.size.width / 2.0, [UIScreen mainScreen].bounds.size.height / 2.0);
[activityView startAnimating];
[self.view addSubview:activityView];
[self presentViewController:shareView animated:YES completion:^{
NSLog(@"Presented facebook");
[activityView removeFromSuperview];
}];