0
votes

I am attempting to present a modal view after a twitter post is successfully completed; however, I cannot present my controller because the SLComposeViewController is still presenting. Is there some completion method that will call when everything is competed and the view has been dismissed?

SLComposeViewController* tweetSheet = [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeTwitter];
    tweetSheet.completionHandler = ^(SLComposeViewControllerResult result){
        UBSTwitterSuccessViewController* twitterView;
        switch(result){
            case SLComposeViewControllerResultCancelled:
                break;
            case SLComposeViewControllerResultDone:
                twitterView = [[UBSTwitterSuccessViewController alloc]initWithNibName:XIBTWITTERSUCCESS bundle:nil];
                [self presentViewController:twitterView animated:YES completion:nil];
                break;
        }
    };
    [tweetSheet setInitialText:@"Check out this cool thing"];
    [tweetSheet addURL: [NSURL URLWithString:@"http://www.cad-comic.com/"]];

    [self presentViewController:tweetSheet animated:NO completion:nil];

warning with no view presented:

Warning: Attempt to present <UBSTwitterSuccessViewController: 0x16569b70>  on <UINavigationController: 0x1663bd30> which is already presenting <SLComposeViewController: 0x166b1170>
1

1 Answers

-1
votes

SLComposeViewController has completionHandler in which you assign a block to be executed when user finished or cancelled composing the post.

completionHandler The handler to call when the user is done composing a post.

@property (nonatomic, copy) SLComposeViewControllerCompletionHandler completionHandler Discussion The handler has a single parameter that indicates whether the user finished or cancelled composing the post. This block is not guaranteed to be called on any particular thread.

Special Considerations In iOS 6 and earlier, if you set a completion handler then your completion handler is responsible for dismissing the SLComposeViewController using dismissViewControllerAnimated:completion:. In iOS 7 and later when compiled with the iOS 7 or later SDK you must not dismiss the SLComposeViewController in your completion handler—the system will do so automatically.

Apple Documentation