iPhone应用程序不工作ipad模拟器
我的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;
我的main.m代码如下:
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; int retVal = UIApplicationMain(argc, argv, nil, nil); [pool release]; return retVal;
这有什么问题?
继续应用目标信息并设置“目标设备系列”:“iPhone”然后它在iphone和ipad模拟器和设备上都可正常工作。
如果你改变这个怎么办:
rootViewController = [[RootViewController alloc] initWithNibName:@"RootViewController" bundle:nil];
对此:
self.rootViewController = [[RootViewController alloc] initWithNibName:@"RootViewController" bundle:nil];
检查….导航控制器委托必须已在IB中连接(委托> AppDelegate)。