【发布时间】:2011-08-04 20:48:59
【问题描述】:
我按照苹果教程"Your First iOS Application"一步步操作,在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?
-
模拟器 --> 4.3 iPod touch --> 3.1.3 我配置了构建设置以考虑到这一点(基础 SDK iOS 4.3,iOS 部署目标 iOS 3.1.3)
标签: iphone ipod-touch