0
我正在开发一个在2011年首次创建的objective-c iOS应用程序,在2013年完成了一些更新和更改。现在,我应该让它工作,因为它正在崩溃错误:旧的iOS应用程序在启动屏幕后崩溃
中的AppDelegateTerminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Application windows are expected to have a root view controller at the end of application launch'
我检查:
[self.window setRootViewController:viewAfterLaunchScreen];
调试后,我已经注意到了,APPLI在viewWillAppear上运行rootViewController后崩溃。
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
if ([[DAL GetPreferences:@"FIRST"] isEqualToString:@"1"])
{
LoginViewController *lvc3 = [[LoginViewController alloc] initWithNibName:@"LoginViewController" bundle:nil];
[self.window setRootViewController:lvc3];
[lvc3 release];
}
else if(_window.rootViewController == nil){
PagingViewController *lvc2 = [[PagingViewController alloc] initWithNibName:@"PagingViewController" bundle:nil];
[self.window setRootViewController:lvc2];
[lvc2 release];
}
[DAL SavePreference:@"FIRST" :@"1"];
[self.window makeKeyAndVisible];
return YES; }
[“应用程序窗口的可能的复制预计将有在根视图控制器结束应用程序启动“错误时运行与Xcode 7,iOS 9项目](http://stackoverflow.com/questions/30884896/application-windows-are-expected-to-have-a-root-view-controller-在末尾) – Mahesh
@Mahesh我已经检查了这个答案之前发布我的问题,我已经提到,我已经检查了setRootViewController。 –
显示你的'didFinishLaunchingWithOptions'方法。 – Mahesh