• XCODE7 和IOS9适配后的一些问题


    网上比较常规的几个问题就不细说了。

    什么HTTPS、bitcode、什么什么的。

    记录几个自己又遇到了但是网上没有说的。

    启动应用报错,

    *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Application windows are expected to have a root view controller at the end of application launch'

    *** First throw call stack:

    (0x185f1cf5c 0x19ab0ff80 0x185f1ce2c 0x186e0bf3c 0x18b7146a4 0x18b711300 0x18fc637ec 0x18fc63b6c 0x185ed45a4 0x185ed4038 0x185ed1d38 0x185e00dc0 0x18b4e00c8 0x18b4daf60 0x1001d2b24 0x19b33a8b8)

    libc++abi.dylib: terminating with uncaught exception of type NSException

    Application windows are expected to have a root view controller at the end of application launch

     
    这个主要是因为:
    新的SDK不允许在设置rootViewController之前做过于复杂的操作,导致在didFinishLaunchingWithOptions 结束后还没有设置rootViewController。
     
    解决办法: 
    self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];  
    [self.window makeKeyAndVisible];  
    之后直接加入代码
    UIViewController* vc = [[UIViewController alloc] initWithNibName:nil bundle:nil];  
    self.window.rootViewController = vc;  
    临时设置一个root,在之后重新对root赋值!
     
    但是我按照方法修改了一下还是没有解决,后来综合了多个方法,首先再开始处处理一下,然后makeKeyAndVisible之后再添加一个空viewcontroller,然后最后再add一个view,解决了这个问题,纠结了好几天啊。真是。。。
     
    就是在刚进入

    didFinishLaunchingWithOptions 的时候

    self.window.rootViewController = [[UIViewController alloc] init]; 这样一下,然后再添加上述代码,然后再这个方法最后使用

     [self.window addSubview:_welcomeViewContraller.view];

    解决了这个问题。可能我的这个和正常的有些不一样,仅供参考。
     
    2.xcode7 程序界面上下有大黑边。
    另外我们app在xcode7运行时还出现了启动应用程序后上下有大黑边的问题,是因为什么没有设置启动屏幕,而在之前的xcode里是没有这个问题的,我们是使用代码设置的。
    xcode7里面则需要手动设置一下。
    问题界面如下图:
     
    解决这个问题的话在xcode里面手动设置一下launchImage就可以了。把自己的启动页拖进去。
    就可以解决这个问题了。
  • 相关阅读:
    刚加入博客园
    个人作业——软件工程实践总结作业
    前四次作业--个人总结
    项目选题报告(待就业六人组)
    结对第二次—文献摘要热词统计及进阶需求
    结对第一次—原型设计(文献摘要热词统计)
    第一次作业
    logback-spring.xml 配置说明
    k8s 微服务打包上传私库、部署、发布
    k8s离线安装监控Kubernetes集群
  • 原文地址:https://www.cnblogs.com/exmyth/p/7538387.html
Copyright © 2020-2023  润新知