iOS开发异常warning:***whose view is not in the window hierarchy!
来源:互联网 发布:python下载matplotlib 编辑:程序博客网 时间:2024/05/21 01:57
在storyboard中,目前碰到几种情况:
1、由controller A跳转到controller B的时候然后报Warning: Attempt to present on whose view is not in the window hierarchy!
2、在controller A中present一个自定义controller B,或者类似UIActivityViewController、UIAlertViewController时,报Warning: Attempt to present controller B on controller A whose view is not in the window hierarchy!
参考:
http://stackoverflow.com/questions/11862883/whose-view-is-not-in-the-window-hierarchy
从这里了解到问题应该是viewDidLoad:与viewDidAppear:的区分了;
确实,上面两个问题的场景都是 将presentVC写在viewDidLoad中了;
那么依据stackoverflow中说法:
“the view controller’s view is not in the window hierarchy at the point that it has been loaded (when the viewDidLoad message is sent), but it is in the window hierarchy after it has been presented (when the viewDidAppear: message is sent).”
如果我翻译的话,就是说正规是在viewDidAppear之后,view才in the window hierarchy,这时presentViewController:才有效
果然,将上面的1、2中的代码移动到viewDidAppear之后, —- AC!
- iOS开发异常warning:***whose view is not in the window hierarchy!
- ios开发异常:whose view is not in the window hierarchy! (20
- [ios开发异常]whose view is not in the window hierarchy!
- iOS开发出错whose view is not in the window hierarchy!的解决
- IOS 开发中 Whose view is not in the window hierarchy 错误的解决办法
- [IOS开发记录]Whose view is not in the window hierarchy 错误的解决办法
- IOS 开发中 Whose view is not in the window hierarchy 错误的解决办法
- iOS 开发中 Whose view is not in the window hierarchy 错误的解决办法
- IOS 开发中 Whose view is not in the window hierarchy 错误的解决办法
- iOS 简单的实现手机号正误的判断(Warning: Attempt to present... whose view is not in the window hierarchy!
- 处理iOS报错: Warning “attempt to present ViewController 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 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 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 xx on yy whose view is not in the window hierarchy!
- 组合预测模型
- maven管理本地jar包
- 关于android更改版本号和版本代码之后仍然不起作用的原因
- RK3288 tinyalsa 播放S24_3LE问题
- 排序算法
- iOS开发异常warning:***whose view is not in the window hierarchy!
- android中Invalidate和postInvalidate的区别
- DirectX技术----D2D学习前言篇及开发环境配置
- 菜鸟从零开始初始WebSocket
- Jetty介绍
- Volley框架搭建--小白级别的,外加Json解析
- 大型网站技术架构 学习总结一(基础了解)
- mysql 分组聚合事例
- 通达OA2015皇钻集群版破解补丁及授权文件无限制8.X