Warning: Attempt to present UINavigationController on NavigationController which is already presenti
2017-03-20 00:00
399 查看
摘要: Warning: Attempt to present <UINavigationController: 0x13c57ecd0> on <XXViewController: 0x13c580d10> which is already presenting (null)
在iOS8中,弹出ActionSheet后选择其中一项,然后在ActionSheet的代理方法
Warning: Attempt to present <UINavigationController: 0x13c57ecd0> on <XXViewController: 0x13c580d10> which is already presenting (null)
然而在iOS7中一切都正常,也不会出现任何警告。出现这种问题的原因是:
Actionsheets and AlertViews were refactored to AlertControllers (iOS8 only), which are both being presented. So, basically, you’re trying to present a controller where you already have a controller presented (ActionSheet), but by the time the debugger gets it, it’s deallocated and it becomes null, producing the warning you see.
以下是解决办法:
1.跳转ViewController这种类型的代码最好写到
2.如果确实需要在
在iOS8中,弹出ActionSheet后选择其中一项,然后在ActionSheet的代理方法
actionSheet(actionSheet:clickedButtonAtIndex:)中使用了
performSegueWithIdentifier方法来跳转到下一个ViewController时,发现ViewController不但没有跳转,控制台却出现了以下警告:
Warning: Attempt to present <UINavigationController: 0x13c57ecd0> on <XXViewController: 0x13c580d10> which is already presenting (null)
然而在iOS7中一切都正常,也不会出现任何警告。出现这种问题的原因是:
Actionsheets and AlertViews were refactored to AlertControllers (iOS8 only), which are both being presented. So, basically, you’re trying to present a controller where you already have a controller presented (ActionSheet), but by the time the debugger gets it, it’s deallocated and it becomes null, producing the warning you see.
以下是解决办法:
1.跳转ViewController这种类型的代码最好写到
actionSheet(actionSheet:, didDismissWithButtonIndex)方法中,保证ActionSheet消失后才跳转。
2.如果确实需要在
actionSheet(actionSheet: clickedButtonAtIndex: )就跳转,那么可以做个延时,比如0.1秒之后再调用
performSegueWithIdentifier方法。
相关文章推荐
- Warning: Attempt to present UINavigationController on NavigationController which is already presenti
- iOS - 解决Warning: Attempt to present <UIImagePickerController: 0x7f9ba106a000>which is already presen
- 项目中遇到的问题(一)弹出UIAlertController 时出现 Warning: Attempt to present * on * which is already presenting
- Warning: Attempt to present <...> on <…> which is already presenting null
- iOS - 解决Warning: Attempt to present <> which is already presenting <>
- iOS: Warning: Attempt to present <ModalViewController> on <ViewController>while a presentation is in
- Warning: Attempt to present BBBViewController on AAAViewController whose view is not in the window hierarchy!
- iOS - 报错 Warning: Attempt to present <xx: xx> on <xx: xx> whose view is not in the window hierarchy!
- Warning: Attempt to present on whose view is not in the window hierarchy!
- 对Warning: Attempt to present on whose view is not in the window hierarchy!的解决方案
- Warning: Attempt to present A on B whose view is not in the window hierarchy!
- 处理iOS报错: Warning “attempt to present ViewController whose view is not in the window hierarchy”
- Warning: Attempt to present A on B whose view is not in the window hierarchy!
- 对Warning: Attempt to present on whose view is not in the window hierarchy!的解决方案
- Warning: Attempt to present A on B whose view is not in the window hierarchy!
- Warning: Attempt to present <NextViewController: 0x10966fed0> on
- 对Warning: Attempt to present XXX on XXX whose view is not in the window hierarchy!的解决方案
- 对Warning: Attempt to present on whose view is not in the window hierarchy!的解决方案
- Warning: Attempt to present on whose view is not in模态跳转问题
- Warning: Attempt to present ControllerA and ControllerB whose view is not in the window hierarchy!