Building to iPod Touch 3.1.3 in Xcode 4
When trying to build my project to my iPod touch 1st gen 3.1.3, the project builds, and it put on my ipod, but then at launch it throws an NSExeption, and gives a SIGABRT at the line self.window.rootViewController = self.viewController;
in my app delegate. The deployment target is all right at 3.0, and the SDK is 4.2. It builds to my iPad running 4.2 fine. What is the problem here?
SOLVED: replace "self.window.rootViewController = self.viewController;" with "[self.window addSubview:_viewController.view];"
@implementation Physics_ProjectAppDelegate
@synthesize window=_window;
@synthesize viewController=_viewController;
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
// Override point for customization after application launch.
[self.window addSubview:_viewController.view];
[self.window makeKeyAndVisible];
return YES;
}
According to documentation, [UIWindow rootViewController]
is
"Available in iOS 4.0 and later." and that is why your app crashes on the actual device which is is 3.1.3 as you say.
精彩评论