多种方案解决*** Assertion failure in -[UIApplication _runWithMainScene:transitionContext:completion:], /Bu
2015-09-21 17:21
435 查看
以下是本来在使用Xcode7时遇到错误的一些解决方案,有网友提供的,也有自己总结的,希望能帮助大家。
错误之
*** Assertion failure in -[UIApplication _runWithMainScene:transitionContext:completion:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/UIKit/UIKit-3505.16/UIApplication.m:3294
这个错误让我一度头疼不已,在网上找了很多方案都没解决,后来自己慢慢的摸索出来的,先给大家分享我自己的解决方案。
解决方案一、不能在
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary
*)launchOptions 方法里面添加引导页代码,(本人就属于这种情况,真TM的坑爹的,苹果不说谁TM知道啊!!!),如下这段代码是添加引导页的,把这段代码注释掉就正常了。
解决方案二、新的SDK不允许在设置rootViewController之前做过于复杂的操作,导致在didFinishLaunchingWithOptions 结束后还没有设置rootViewController。(这个方案是网友提供的,但是没解决我的问题),具体做法是,先虚设一个rootViewController,代码如下
解决方案三、在Info.plist中,可以找到:“Main storyboard file base name” String “Main”,删掉这个条目, 再启动,屏幕变成了黑屏,然后手动添加window,具体代码如下:
错误之
*** Assertion failure in -[UIApplication _runWithMainScene:transitionContext:completion:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/UIKit/UIKit-3505.16/UIApplication.m:3294
这个错误让我一度头疼不已,在网上找了很多方案都没解决,后来自己慢慢的摸索出来的,先给大家分享我自己的解决方案。
解决方案一、不能在
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary
*)launchOptions 方法里面添加引导页代码,(本人就属于这种情况,真TM的坑爹的,苹果不说谁TM知道啊!!!),如下这段代码是添加引导页的,把这段代码注释掉就正常了。
//xcode7 不能在application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions里面加载启动页,所以下面这段添加引导页的代码应该是要删除的。 切记!切记! // if (![[NSUserDefaults standardUserDefaults]boolForKey:@"everLaunched"]) { // myView=[[UIImageView alloc]initWithFrame:CGRectMake(0, 0, self.window.bounds.size.width, self.window.bounds.size.height)]; // [myView setImage:[UIImage imageNamed:@"mainPage.png"]]; // [self.window.rootViewController.view addSubview:myView]; // MiIntroductionViewController *introVC=[[MiIntroductionViewController alloc]initWithNibName:@"MiIntroductionViewController" bundle:nil]; // [self.window.rootViewController presentViewController:introVC animated:NO completion:nil]; // [[NSUserDefaults standardUserDefaults]setBool:YES forKey:@"everLaunched"]; // }else{ // [self buildInstoSpecialEdition]; // }
解决方案二、新的SDK不允许在设置rootViewController之前做过于复杂的操作,导致在didFinishLaunchingWithOptions 结束后还没有设置rootViewController。(这个方案是网友提供的,但是没解决我的问题),具体做法是,先虚设一个rootViewController,代码如下
// [self.window makeKeyAndVisible]; // UIViewController* myvc = [[UIViewController alloc] initWithNibName:nil bundle:nil]; // self.window.rootViewController = myvc;
解决方案三、在Info.plist中,可以找到:“Main storyboard file base name” String “Main”,删掉这个条目, 再启动,屏幕变成了黑屏,然后手动添加window,具体代码如下:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { // Override point for customization after application launch. self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; //全屏window self.window.backgroundColor = [UIColor whiteColor]; //白色背景 [self.window makeKeyAndVisible]; // return YES; }
相关文章推荐
- iOS_文章3党库SDWebImage
- Android教程-02 在程序中输出Log
- Android教程-02 在程序中输出Log
- 七牛如何安装ios sdk (使用纯源码安装)
- Ionic学习笔记
- IOS解析json报错-[__NSCFString objectFromJSONString]: unrecognized selector sent to 解决办法
- Masonry -- 使用纯代码进行iOS应用的autolayout自适应布局
- Android AndroidManifest 清单文件以及权限详解
- iOS使用CoreMotion实现摇一摇功能
- 申请iOS公司开发者账号
- Masonry -- 使用纯代码进行iOS应用的autolayout自适应布局
- 安卓圆形头像制作两种方法。
- JCOB分分钟word和excel互转,word和excel转html,webApp的福利
- iOS开发笔记-将图片处理成圆形或者说特定圆角
- android lowmemorykiller机制简介
- android ListView根据字母排序和定位
- Android自定义属性时TypedArray的使用方法
- ios 白名单
- Change Xamarin iOS navigation and status bar color
- Unity3D之Lightmap详解