Note that there are some explanatory texts on larger screens.

plurals
  1. POSLComposeViewController dismisses its parent VC
    primarykey
    data
    text
    <p>I am using SLComposeViewController to post on Twitter, all is working fine but when the post is successful it Dismisses the parent view controller also. </p> <pre><code>-(void)showTweetSheet { // Create an instance of the Tweet Sheet SLComposeViewController *tweetSheet = [SLComposeViewController composeViewControllerForServiceType: SLServiceTypeTwitter]; // Sets the completion handler. Note that we don't know which thread the // block will be called on, so we need to ensure that any UI updates occur // on the main queue tweetSheet.completionHandler = ^(SLComposeViewControllerResult result) { switch(result) { // This means the user cancelled without sending the Tweet case SLComposeViewControllerResultCancelled: NSLog(@"User Canceled the Twitter Sharing"); break; // This means the user hit 'Send' case SLComposeViewControllerResultDone: NSLog(@"Tweet has been posted successfully!"); break; } // dismiss the Tweet Sheet dispatch_async(dispatch_get_main_queue(), ^{ [self dismissViewControllerAnimated:NO completion:^{ NSLog(@"Tweet Sheet has been dismissed."); }]; }); }; // Set the initial body of the Tweet [tweetSheet setInitialText:[NSString stringWithFormat:@"Hurrah! I have earned %@ Badge on %@ app.", [badges objectAtIndex:badgeID], [UIApplication appDisplayName]]]; // Adds an image to the Tweet. For demo purposes if (![tweetSheet addImage:[UIImage imageNamed:[NSString stringWithFormat:@"Badge%d.jpg", badgeID]]]) { NSLog(@"Unable to add the image!"); } // Add an URL to the Tweet. You can add multiple URLs. if (![tweetSheet addURL:[NSURL URLWithString:[NSString stringWithFormat:@"https://itunes.apple.com//app//id%@", [UserDefaultsOperations getAppleAppID]]]]){ NSLog(@"Unable to add the URL!"); } // Presents the Tweet Sheet to the user [self presentViewController:tweetSheet animated:NO completion:^{ NSLog(@"Tweet sheet has been presented."); }]; } </code></pre> <p>I don't want to dismiss parent view controller. Please help!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload