Ios 尝试关闭视图控制器时发出警告(模式中的模式)
当我的iOS应用程序第一次启动时,我会自动打开一个“欢迎”模式,如下所示:Ios 尝试关闭视图控制器时发出警告(模式中的模式),ios,objective-c,presentviewcontroller,Ios,Objective C,Presentviewcontroller,当我的iOS应用程序第一次启动时,我会自动打开一个“欢迎”模式,如下所示: UIViewController *intro = [self.storyboard instantiateViewControllerWithIdentifier:@"intro"]; intro.modalPresentationStyle = UIModalPresentationFullScreen; //Show the modal [self presentViewController:intro ani
UIViewController *intro = [self.storyboard instantiateViewControllerWithIdentifier:@"intro"];
intro.modalPresentationStyle = UIModalPresentationFullScreen;
//Show the modal
[self presentViewController:intro animated:NO completion:nil];
在该模式中,用户被指示将应用程序链接到Dropbox。他们点击一个按钮来触发这个:
[[DBSession sharedSession] linkFromController:self];
这是一个Dropbox SDK方法,它在另一个模式中打开Dropbox身份验证UIWebView,如下所示:
一旦他们登录,模态将自动设置关闭动画
然后,我尝试用以下内容关闭原始的介绍模式:
[self dismissViewControllerAnimated:YES completion:nil];
但是我收到了这个警告,模式没有关闭:
警告:当演示或取消正在进行时,尝试从视图控制器取消
以下是我尝试过的:
dismissViewControllerAnimated
之前,让Dropbox模式关闭,但它没有帮助:[NSThread sleepForTimeInterval:2.0]代码>
[self dismissViewControllerAnimated:NO completion:nil]代码>这也没用
如果(![self isbeingdisemployed]){…}
并且没有运气[self dismissViewControllerAnimated:YES completion:nil];
从introViewController内部,而不是从根控制器中。如果没有其他模式,则应调用self.presentingViewController。因此,我将一个嵌套在第一个的完成句柄块中。我发现,如果您在上一个事务(动画)进行时尝试推/关闭视图控制器,则会出现此问题 在
0.50到1秒之间取NSTimer
并解除ViewController。这是一个非常有用的技巧,可以让当前的viewController完成动画
否则不确定,但尝试使用解除视图控制器激活
设置否
[self dismissViewControllerAnimated:NO completion:nil];
我发现了这个问题。您可以在DBSession+ios.m
[rootController presentModalViewController:导航控制器
动画:是]
因此,在内部,他们将从self
显示身份验证视图控制器。您已经从self
演示了视图控制器。所以,当他们或您试图从self中关闭视图控制器时,请发出此警告,因为它已显示视图控制器。因此,不要将self传递给dropBox,而是传递intro
view controller
[[DBSession sharedSession] linkFromController:intro];
隐马尔可夫模型。。。我正在从内部打开Dropbox模式intro
,因此引用它需要指向self
,不是吗<代码>简介
已在父控制器中打开。请尝试其他方式。。[[DBSession sharedSession]linkFromController:self.presentingViewController];不知何故,模态控制器堆栈被破坏了,它们没有干净地堆积起来。确切的说,在验证之后,您在哪里尝试排除?这就是如何获得已验证并被撤销的委托方法的方法?我尝试了self.presentingViewController,但这不起作用,因为我当前的模式(introViewController)正在覆盖它。是的,存在问题。因为代理总是在被解雇之前被调用。我可能不清楚,但我是从内部调用dismissViewControllerAnimated
,没有运气:(我尝试了计时器延迟并关闭了动画,但错误仍然发生。