应用程序崩溃在iPod touch上,但不是在iPhone模拟器上
问题描述:
我跟着苹果教程"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版本。您将不得不更新或构建一些有条件的解决方法。
rootViewController该窗口的根视图 控制器。
@属性(非原子,保留) 的UIViewController * RootViewController的 讨论的根视图控制器 提供 窗口的内容图。将视图控制器分配给 此属性(编程为 或使用Interface Builder)将视图控制器的视图安装为窗口的内容视图 。如果 窗口具有现有的视图层次结构 ,则在安装 新视图之前将删除旧视图。
此属性的默认值为 无。
可用性在以后的iOS 4.0和 中可用。
+0
,错过了那个点:) – kite 2011-04-13 16:15:46
你的设备上运行的是什么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