appDelegate.m文件在运行样本时候中止
self.view.controller=root.view.controller
请帮忙加下面的代码:
-(BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
/* 这行出错了 */
self.window.rootViewController=self.viewController;
[self.window makeKeyAndVisible];
return YES;
}
ios4之前的版本没有UIWindow rootViewController。如果要在ios3或者之前的版本运行的话,就会崩溃。
在你的appdelegate中使用addsubbiew代替:
//self.window.rootViewController = self.viewController; // Only iOS >= 4 [self.window addSubview:self.viewController.view]; [self.window makeKeyAndVisible]; return YES
[self.window setRootViewController : self.viewController];