
“Application windows are expected to have a root vIEw controller at the end of application launch”
下面是我的一段代码,在输入返回YES行后会发生崩溃.
- (BOol)application:(UIApplication *)application dIDFinishLaunchingWithOptions:(NSDictionary *)launchOptions{ UIImageVIEw *defaultimage = [[UIImageVIEw alloc] initWithImage:splashImage]; defaultimage.frame = defaultimageFrame; [self.window addSubvIEw:defaultimage]; [NSTimer scheduledTimerWithTimeInterval:3.0 target:self selector:@selector(login:) userInfo:nil repeats:NO]; [self.window setBackgroundcolor:[UIcolor clearcolor]]; [self.window makeKeyAndVisible]; return YES; // here crash will happens}-(voID)login:(ID)sender{ PreLoginVIEwController *appController = [[PreLoginVIEwController alloc] initWithNibname:nil bundle:nil]; if (_ChooseLogin.isstatus == 105) { flagrequired = @"1"; appController.serverDownFlag = @"1"; } appController.termsURL = _ChooseLogin.urlString; appController._ChooseLogin = _ChooseLogin; appController.rootNetworkAvailable = NO; appController.verionMsg = versionStr; [dft setBool:NO forKey:@"isNeedActivate"]; appController.isNeedActivate = NO; navigationController = [[UINavigationController alloc] initWithRootVIEwController:appController];} 谁知道如何解决这个问题?它在iOS 8中运行良好,直到Xcode 6.3.
解决方法 您需要在dIDFinishLaunchingWithOptions中调用setRootVIEwController:并且您需要一个视图控制器来执行此 *** 作.在代码中:
UIVIEwController *vc = [[UIVIEwController alloc] init];[vc.vIEw addSubvIEw:defaultimage]; [self.window setRootVIEwController:vc];总结
以上是内存溢出为你收集整理的在Xcode 7中,iOS 9“应用程序窗口应该在应用程序启动结束时具有根视图控制器”全部内容,希望文章能够帮你解决在Xcode 7中,iOS 9“应用程序窗口应该在应用程序启动结束时具有根视图控制器”所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)