How to make the presentViewController with SLComposeViewController faster?

前端 未结 2 1071
轻奢々
轻奢々 2020-12-19 16:39

I am opening the Twitter compose view on my app, but the screen takes too long to be displayed!

I started using the following code when the user taps the twitter but

2条回答
  •  独厮守ぢ
    2020-12-19 17:06

    I had the same issue -- it was driving me crazy. I fixed it by dispatch_async on the main queue

    // Perform this on the main queue
    __weak __typeof(self) weakSelf = self; 
    
    dispatch_async(dispatch_get_main_queue(), ^{
        __strong __typeof(self) strongLocalSelf = weakSelf;
    
    
            SLComposeViewController *controller = [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeFacebook];
            [controller setInitialText:@"Share message"];
            [controller addURL:@"http://www.someURL.com"];
            [strongLocalSelf presentViewController:controller animated:NO completion:nil];
    
    
    });
    

提交回复
热议问题