错误分析:

           controller A present controller B ,前提是A的view要存在,如果不存在,就会报这个错。
 
解决方法: 
           将原来的present语句由 viewDidLoad方法中移到 viewDidAppear中,问题就可以解决。但是这样的话,画面会闪现一下parentViewController的view,这个问题目前不清楚怎么解决,有待高人指点。
并且viewDidAppear这个方法是每次都进入,和ViewDidLoad只进一次不同,所以无法达到我要的效果。
 
最终方案:
           摈弃presentModel方法,在viewDidLoad中添加如下语句:
              [self.view addSubview:controllerB.view];

[self addChildViewController:controllerB];

自己添加想要的动画,实现对presentModel方法的模仿。

Warning: Attempt to present on whose view is not in模态跳转问题的更多相关文章

  1. Warning: Attempt to present on whose view is not in the window hierarchy!

    当我想从一个VC跳转到另一个VC的时候,一般会用 - (void)presentViewController:(UIViewController *)viewControllerToPresent a ...

  2. 错误: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 ...

  3. Warning: Attempt to present A on B whose view is not in the window hierarchy!

    昨天写豆瓣发广播Demo的时候,为了写Demo的简单,就使用了Storyboard,结果执行视图跳转时遇到了这个问题: Warning: Attempt to present <UINaviga ...

  4. Warning: Attempt to present * on * which is already presenting *

    Warning: Attempt to present (要被presented的控制器)  on (哪个控制器来presenting) which is already presenting (已经 ...

  5. swift一次 Attempt to present on whose view is not in the window hierarchy的解决方法

    做的是二维码扫描,扫描后识别为URL的话就跳转到webview 加载网页,用的是代理传值的方式.扫描到了 值传递到主页 扫描窗体退出,检测值是否是http://开头 是网页就跳转. 问题出在传值到主界 ...

  6. iOS8 iPad Warning: Attempt to present <UIImagePickerController:xxxx > on xxxx which is already presenting (null)

    解决方法: /* I think this is because in iOS 8, alert views and action sheets are actually presented view ...

  7. Attempt to present <vc> on <vc> which is already presenting <vc>/(null)

    在给 tableViewCell 添加长按手势弹出一个 popViewController 的时候,遇到的这个变态问题: Warning: Attempt to present <UINavig ...

  8. Attempt to present <TestViewController2: 0x7fd7f8d10f30> on <ViewController: 0x7fd7f8c054c0> whose view is not in the window hierarchy!

    当 storyboard里面的 按钮 即连接了 类文件里面的点击方法  又  连接了   storyboard里 另一个  控制器的  modal 就会出现类似Attempt to present & ...

  9. Warning: Attempt to dismiss from view controller <UIViewController: 0x17d71c10> while a presentation or dismiss is in progress!

    昨天 调试程序 已经快要上线了 突然有个BUG 找了半天 才找到是因为这个警告 但是 解决这个警告又花了一天的时间 试了各种消除控制器的方法 都不可用 其中 并且 有这个bug  手机真机测试完全没问 ...

随机推荐

  1. JS定时器的使用--数码时钟

    <title>无标题文档</title> <script> function toDou(n){ if(n<10){ return '0'+n; }else{ ...

  2. 在window系统下搭建基于ssh的git服务器

    以下是基于window server 2012搭建的,学习搭建过程需要很多问题,找了许多文章做了一下总结. 1.所需的软件 Git for Windows: MsysGit(Git-1.7.4-pre ...

  3. Windows API 之 CreateThread、WaitForSingleObject(未完)

    WaitForSingleObject Waits until the specified object is in the signaled state or the time-out interv ...

  4. 支付宝集成+网站支付+APP支付+手机网站支付

    网站支付宝 1.申请签约后获得相应的pid:208***开头和key 这里说明下pc网站支付采用md5加密所以这里只需要提供pid和key不需要上传公钥. 2.下载即时到账demo http://do ...

  5. map转换成list

    Java代码如下: package Test01; import java.util.ArrayList; import java.util.HashMap; import java.util.Ite ...

  6. 关于Eclipse无法生成class文件的问题

    今天调试东西的时候发现怎么都无法build 遂用Eclipse里的clean功能 打算重新编译一下结果所有的class文件全部消失了 重新打包发包也不行 经过查找后得到方法:把properties属性 ...

  7. 一个完整的ant build.xml

    <?xml version="1.0" encoding="UTF-8"?> <project name="genwar" ...

  8. DWR 整合之Hibernate

    1.让 DWR 和 Hibernate 一起工作的检查列表 1.确保你使用的是最新的 DWR.Hibernate 转换器是新东西,所以你需要下载最新版本 2.确保你的 Hiberante 在没有 DW ...

  9. Android网络开发之Volley--Volley基本用法ImageRequest(三)

    1.ImageRequest用法和StringRequest一样,主要分为3步: (1).实例化一个RequestQueue对象 (2).设置ImageRequest对象参数,并将ImageReque ...

  10. ecostore搜索注意事项

    ecostore搜索时会把特殊字符转换为相应的文字 如 洋河480ml_52°天之蓝 进行html url编码时会把_(下划线)转换成%25xia%25(%25对应的ascii是%) 搜索时会把%.x ...