我的应用程序适用于iPad和iPhone上的iOS 5.1。在iOS 6应用程序在iPad上工作正常,但在设置window.rootViewController = navigationViewController
时在iPhone中崩溃。我设置了Exception断点,它在application didFinishLaunchingWithOptions
的这段代码中停止执行。我甚至尝试将其添加为[window addSubView:navigationViewController.view]
,但没有运气。有没有人遇到过类似的问题。
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions: (NSDictionary *)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
rootViewController = [[SpringboardViewController alloc] initWithNibName:@"SpringboardViewController" bundle:nil];
UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:rootViewController];
self.window.rootViewController = nav;
self.window makeKeyAndVisible];
return YES;
}
答案 0 :(得分:0)
看看这些问题
applications expected to have a root view controller console
Applications are expected to have a root view controller at the end of application launch
答案 1 :(得分:0)
感谢您的回复,我发现了问题,问题在于application supportedInterfaceOrientationsForWindow
我返回UIInterfaceOrientationPortrait
而不是UIInterfaceOrientationMaskPortrait
,因为app调试器被自我击中了。 window.rootViewController = nav ,我认为这个陈述存在问题。
感谢Ravindharan和Ogres。