Warning: Attempt to present on whose view is not in the window hierarchy!
当我想从一个VC跳转到另一个VC的时候,一般会用
- (void)presentViewController:(UIViewController *)viewControllerToPresent animated: (BOOL)flag completion:(void (^)(void))completion;当然也可以用导航push。
有时会遇到了此类警告:Warning: Attempt to present on whose view is not in the window hierarchy!
原因:页面跳转必须在viewDidLoad和viewDidAppear之后才能进行。
解决办法:必须确保页面跳转要在view load完毕之后进行。
第一种:通过延时来等待view Load执行结束,但是这个方法在时间上不好把握
第二种:在viewDidLoad里用
[selfperformSelectorOnMainThread:@selector(login)withObject:nilwaitUntilDone:NO];
把页面跳转的代码写进函数里,然后将 waitUntilDone 设为NO
Warning: Attempt to present on whose view is not in the window hierarchy!的更多相关文章
- swift一次 Attempt to present on whose view is not in the window hierarchy的解决方法
做的是二维码扫描,扫描后识别为URL的话就跳转到webview 加载网页,用的是代理传值的方式.扫描到了 值传递到主页 扫描窗体退出,检测值是否是http://开头 是网页就跳转. 问题出在传值到主界 ...
- Warning: Attempt to present on whose view is not in模态跳转问题
错误分析: controller A present controller B ,前提是A的view要存在,如果不存在,就会报这个错. 解决方法: 将 ...
- 错误:Warning: Attempt to present <UIAlertController: 0x7fd192806e20> on <ViewController: 0x7fd1928048d0> whose view is not in the window hierarchy!
系统:mac OS 10.12 (16A323) Xcod:8.3.3 错误:Warning: Attempt to present <UIAlertController: 0x7fd1928 ...
- Warning: Attempt to present A on B whose view is not in the window hierarchy!
昨天写豆瓣发广播Demo的时候,为了写Demo的简单,就使用了Storyboard,结果执行视图跳转时遇到了这个问题: Warning: Attempt to present <UINaviga ...
- Warning: Attempt to present * on * which is already presenting *
Warning: Attempt to present (要被presented的控制器) on (哪个控制器来presenting) which is already presenting (已经 ...
- Attempt to present <TestViewController2: 0x7fd7f8d10f30> on <ViewController: 0x7fd7f8c054c0> whose view is not in the window hierarchy!
当 storyboard里面的 按钮 即连接了 类文件里面的点击方法 又 连接了 storyboard里 另一个 控制器的 modal 就会出现类似Attempt to present & ...
- Swift - whose view is not in the window hierarchy 问题解决方法
问题现象:想在页面初始化的时候,使用self.presentViewController方法弹出个告警提示框UIAlertController.但行后报了个如下告警,同时告警框也出不来. 1 2015 ...
- iOS开发出错whose view is not in the window hierarchy!的解决
大熊猫猪·侯佩原创或翻译作品.欢迎转载,转载请注明出处. 如果觉得写的不好请多提意见,如果觉得不错请多多支持点赞.谢谢! hopy ;) 一个简单的单窗口App在运行时出现错误: 2016-04-07 ...
- whose view is not in the window hierarchy
参考:http://www.jianshu.com/p/9e90cb866fdf 在做界面跳转的时候,我们经常会用到这两个函数 func dismissViewControllerAnimated(f ...
随机推荐
- java基础--相等
学习:http://www.cnblogs.com/dolphin0520/p/3780005.html#3163302 后发现居然有这么个东西,当然也不会注意什么自动拆箱和装箱,只知道用就行了.不过 ...
- 搭建CnetOS6.5x64最小系统及在线yum源的配置
CentOS系统作为红帽系列的一款linux系统,因为其免费.开源,在中小企业中得到了广泛应用,生产上为了更好的利用资源,都采用最小系统安装,因为一个图形界面都会占去系统资源的30%到40%,生产上一 ...
- [译]学习IPython进行交互式计算和数据可视化(四)
第三章 使用Python进行数字计算 尽管IPython强大的shell和扩展后的控制台能被任何Python程序员使用,但是这个工具最初是科学奖为科学家设计的.它的主要设计目标就是为使用Python进 ...
- Auto Mapper01
在项目中一直在使用Auto Mapper技术,但是只是会简单的使用,对其里面的一些具体的细节和知识点不是很清楚,现在就跟着我从最基础的知识点来重新认识下,AutoMapper技术吧. ...
- 两种CSS3圆环进度条详解
晚上睡觉之前,我抽了1个多小时,研究了一下圆环进度条,结合从网上查阅的资料,我终于掌握了两种圆环的生成方法. 这次的效果就是单纯的CSS3效果,也没有写具体的JS,等以后有时间在好好整理一下吧~. 第 ...
- 【原创】.NET Web API之filter ActionFilterAttribute 过滤器使用
1.在filter类里面引用,与MVC里面的不同 using System.Web.Http.Controllers; using System.Web.Http.Filters; 2.filter类 ...
- C语言学习006:歌曲搜索
#include <stdio.h> #include <string.h> //字符串处理库 ]={ "I left my heart in Harvard Med ...
- char导致的验证异常
表的一个字段: Moblie char(15) 对应的mvc代码: @Html.EditorFor(c => c.Mobile) [RegularExpression("^1[3|4 ...
- JS数组添加字典的方法
var ary_RoleType = []; //申明数组变量 for(var j = 0;j<treeData.length;j++){ if($.inArray(treeData[j].v ...
- java servlet手机app访问接口(三)高德地图云存储及检索
这篇关于高德地图的随笔内容会多一点, 一.业务说明 对应APP业务中的成员有两类,一是服务人员,二是被服务人员, 主要实现功能, 对APP中的服务人员位置进行时时定位, 然后通过被服务人员登 ...