我跟着苹果教程"Your First iOS Application"一步一步,它在iPhone模拟器上完美工作。应用程序崩溃在iPod touch上,但不是在iPhone模拟器上
但是,当我尝试将它部署到iPod touch上时,应用程序崩溃。
这里是有问题的方法:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
MyViewController *acontroller = [[MyViewController alloc] initWithNibName:@"MyViewController" bundle:[NSBundle mainBundle]];
[self setMyViewController:acontroller];
[[self window] setRootViewController:[self myViewController]]; // crash here
[self.window makeKeyAndVisible];
[acontroller release];
return YES;
}
这里是错误消息:
011-04-13 18:07:53.730 ios_HelloWorld[865:207] *** -[UIWindow setRootViewController:]: unrecognized selector sent to instance 0x119520
2011-04-13 18:07:53.754 ios_HelloWorld[865:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[UIWindow setRootViewController:]: unrecognized selector sent to instance 0x119520'
2011-04-13 18:07:53.770 ios_HelloWorld[865:207] Stack: (
843631901,
849079828,
843635709,
843131673,
843094080,
11801,
857435720,
857434728,
857767424,
857765436,
857763988,
875472868,
843380011,
843377695,
857431048,
857424432,
11553,
11476
)
terminate called after throwing an instance of 'NSException'
考虑,我紧跟着步骤教程步骤(由我自己,重新做了),并且它在这个位置总是崩溃。
有什么想法?
感谢
风筝
你的设备上运行的是什么iOS? – 2011-04-13 16:12:56
模拟器 - > 4.3 iPod touch - > 3.1.3 我配置了构建设置以考虑到这一点(基础SDK iOS 4.3,iOS部署目标iOS 3.1.3) – kite 2011-04-13 16:14:08