我想唯一的應用程序轉換我的iPhone到普遍應用。我將設備切換到Universal,讓Xcode爲我製作MainWindow-iPad.xib,現在當我在iPhone模擬器中運行應用程序時,它可以正常工作,但是當我在iPad模擬器中運行它時,屏幕和Application windows are expected to have a root view controller at the end of application launch
錯誤。我已閱讀了一些關於這個相同問題的其他文章,但沒有一篇僅限於一個設備。「應用程序窗口預計將有在應用程序啓動的最後一個根視圖控制器」錯誤只在iPad上
這裏是我的application:didFinishLaunchWithOptions:
方法:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
/* some dropbox setup stuff */
// INIT VIEW AND CORE DATA
RootViewController *rootViewController = [[RootViewController alloc] initWithNibName:@"RootViewController" bundle:nil];
NSManagedObjectContext *context = [self managedObjectContext];
if (!context) {
// Handle the error.
}
rootViewController.managedObjectContext = context;
UINavigationController *aNavigationController = [[UINavigationController alloc] initWithRootViewController:rootViewController];
self.navigationController = aNavigationController;
[_window addSubview:[_navigationController view]];
[_window makeKeyAndVisible];
[rootViewController release];
[aNavigationController release];
return YES;
}
編輯:我只是有大小適合iPhone稱爲RootViewController的一個根視圖控制器。但它應該仍然是不應該加載?或者,如果它不應該如何爲iPad創建一個?
愚弄:http://stackoverflow.com/q/7520971/9530 http://stackoverflow.com/q/12784411/9530 http://stackoverflow.com/q/8190567/9530的http://計算器。 COM/q /九千五百三十零分之一千一百五十一萬五千八百十八http://stackoverflow.com/q/9844626/9530甚至更多 – 2013-03-08 20:40:31