我跟着蘋果教程"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