以下是本来在使用Xcode7时遇到错误的一些解决方案,有网友提供的,也有自己总结的,希望能帮助大家。
错误之
*** Assertion failure in -[UIApplication _runWithMainScene:transitionContext: completion:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/UIKit/UIKit-3505.16/UIApplication.m:3294
//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]; // }
// [self.window makeKeyAndVisible]; // UIViewController* myvc = [[UIViewController alloc] initWithNibName:nil bundle:nil]; // self.window.rootViewController = myvc;解决方案三
- (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; }
// self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; rootViewController = [[RootViewController alloc] initWithNibName:@"RootViewController" bundle:nil]; UINavigationController *navg = [[UINavigationController alloc]initWithRootViewController:rootViewController]; navg.navigationBarHidden = YES; self.window.rootViewController=navg; self.window.backgroundColor = [UIColor whiteColor]; [self.window makeKeyAndVisible];给window设置主屏幕大小 屏掉 试了一下 就OK了 !!!