2

I tried asking this question over at apple.stackexchange.com, but it was marked as off-topic for that board, so I'm hoping here is more appropriate:

I am following 2 iOS tutorials (Big Nerd Ranch and another one), both of which explicitly state they're using XCode 5 and iOS 7. When referencing the method 'application:didFinishLaunchingWithOptions:' of AppDelegate.m, both also show pre-existing code which initializes 'self.window' and, further down in the method, calls [self.window makeKeyAndVisible]. For example, the following image was taken from this tutorial:

enter image description here

I am using XCode 6.4 with iOS 8.4. I've tried creating several types of applications, including single-view apps, master-detail apps, and page-based apps. In each of these apps, the default template for the 'application:didFinishLaunchingWithOptions:' method appears as follows:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    // Override point for customization after application launch.
    return YES;
}

I'm wondering why the code seems to be missing from my Xcode 7 default templates. It seems like something most devs would want included by default, since now they'll likely have to write it manually for most apps. Therefore, if Apple did indeed remove it, I'm curious what the motivation for this could have been.

Richie Thomas
  • 3,073
  • 4
  • 32
  • 55

1 Answers1

2

This is because by default new projects are configured to use storyboards, which do not require the AppDelegate to setup the window.

Mark
  • 7,167
  • 4
  • 44
  • 68
  • Is there a way to change the default configuration to include the code? – Richie Thomas Jan 30 '16 at 04:30
  • You can modify the templates that Xcode uses, but you'll have to update them anytime you update Xcode, since it will get overridden. This question might be able to help you with that: http://stackoverflow.com/q/33720/797767 – Mark Jan 30 '16 at 04:35