IOS/Objective-C:在SLComposer消息后关闭视图控制器

IOS/Objective-C:在SLComposer消息后关闭视图控制器,ios,objective-c,slcomposeviewcontroller,Ios,Objective C,Slcomposeviewcontroller,我正在尝试在SLComposer发送消息后关闭视图控制器 为此,我在SLComposer方法中使用完成块,如下所示: [myPostSheet setCompletionHandler:^(SLComposeViewControllerResult result) { switch (result) { case SLComposeViewControllerResultCancelled: NSLog(@"Pos

我正在尝试在SLComposer发送消息后关闭视图控制器

为此,我在SLComposer方法中使用完成块,如下所示:

  [myPostSheet setCompletionHandler:^(SLComposeViewControllerResult result) {

            switch (result) {


        case SLComposeViewControllerResultCancelled:
                NSLog(@"Post Canceled");
            [self alertPostFail];
                break;
            case SLComposeViewControllerResultDone:
                NSLog(@"Post Successful");
                success = 1;
                [self dismissUnderlyingVC ];

                break;

            default:
                break;
        }
    }];

-(void)dismissUnderlyingVC {
    LogDebug(@"trying to dismiss Underlying VC");
   [self dismissViewControllerAnimated:YES completion:nil];
}
然而,尽管我将解雇放在了完成块中,它还是在SLComposer实际被解雇之前被解雇,没有解雇下一个VC,并且给出了以下错误:

     -[myVC dismissUnderlyingVC][Line 227] [DEBUG]
 trying to dismiss Underlying VC
    2018-08-28 20:23:59.579416-0400 idaru[1772:662392]
 [core] SLComposeViewController skipping explicit 
dismiss because isBeingDismissed is already 1
    2018-08-28 20:23:59.588142-0400 
idaru[1772:662392] [core] SLComposeViewController dealloc 
我推测SLComposer没有代表,因此我想知道如何确定它实际上已被解雇,以便我可以解雇它下面的下一个VC


提前感谢您的建议。

您的视图控制器当前正在演示SLComposeViewController

因此,当您调用dismissViewControllerAnimated:completion:on self时,实际上是在请求解除已在解除过程中的SLComposeViewController

请尝试让presentingViewController关闭:

[self.presentingViewController dismissViewControllerAnimated:YES completion:nil];
可能重复的