Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/iphone/39.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Iphone SLComposeViewController解除其父VC_Iphone_Objective C_Uiviewcontroller_Ios7_Slcomposeviewcontroller - Fatal编程技术网

Iphone SLComposeViewController解除其父VC

Iphone SLComposeViewController解除其父VC,iphone,objective-c,uiviewcontroller,ios7,slcomposeviewcontroller,Iphone,Objective C,Uiviewcontroller,Ios7,Slcomposeviewcontroller,我正在使用SLComposeViewController在Twitter上发帖,一切正常,但发帖成功后,一切都会恢复正常 也会解除父视图控制器 -(void)showTweetSheet { // Create an instance of the Tweet Sheet SLComposeViewController *tweetSheet = [SLComposeViewController composeV

我正在使用SLComposeViewController在Twitter上发帖,一切正常,但发帖成功后,一切都会恢复正常 也会解除父视图控制器

-(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.");
 }];

}

我不想取消父视图控制器。请帮忙

只需在上述代码中注释这些行:

//  dismiss the Tweet Sheet
dispatch_async(dispatch_get_main_queue(), ^{
     [self dismissViewControllerAnimated:NO completion:^{
     NSLog(@"Tweet Sheet has been dismissed.");
}];

我猜当completionHandler被调用时,工作表已经被解除,因此没有必要再次解除。