我的iphone应用程序可以在iphone模拟器和设备上运行,但不能在ipad模拟器上运行。它没有显示任何错误,但应用程序没有启动,只显示空白黑屏。
在ipad模拟器5中运行时,它显示以下错误"应用程序预计在应用程序启动结束时具有根视图控制器"
我的应用didFinishLaunchingWithOptions代码如下:
rootViewController = [[RootViewController alloc] initWithNibName:@"RootViewController" bundle:nil];
[self.rootViewController.view setFrame:CGRectMake(0, 20, 320, 460)];
[self.window addSubview:self.rootViewController.view];
[self.window makeKeyAndVisible];
return YES;
和我的主。M代码如下:
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
int retVal = UIApplicationMain(argc, argv, nil, nil);
[pool release];
return retVal;
这有什么不对??
进入App Target info并设置"Target device Family":"iPhone"然后它在iPhone和ipad模拟器和设备上都能正常工作。
如果你改变这个呢:
rootViewController = [[RootViewController alloc] initWithNibName:@"RootViewController" bundle:nil];
:
self.rootViewController = [[RootViewController alloc] initWithNibName:@"RootViewController" bundle:nil];
查看....导航控制器委托必须在IB中被连接(delegate> AppDelegate)。