self.window.rootViewController vs window addSubview

后端 未结 5 639
一向
一向 2020-12-05 04:17

I\'ve noticed a lot of examples for iPhone apps in the Application Delegate

- (void)applicationDidFinishLaunching:(UIApplication *)application

h

5条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-05 04:34

    The crash is because you're calling a method that doesn't exist, not because your variables are not initialized.

    -setRootViewController doesn't exist prior to iOS 4.0. Use

    [self.window addSubview:self.tabBarController.view]; instead.

    Or, update your target platfor to 4.0.2 or later. It's probably less than 5% of users that aren't using iOS 4 at this point.

提交回复
热议问题