Initial didFinishLaunchingWithOptions method


#1

I think I might have a different version of XCode than this book targets, but can’t find it mentioned -anywhere- in the book. I say that because the default methods are written a bit differently than in the book.
Expected:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions: (NSDistionary *)launchOptions { // etc [window makeKeyAndVisible]; return YES; }

My XCode Prints:

- (void)applicationDidFinishLaunching:(UIApplication *)application { [window makeKeyAndVisible]; //NO return value }

I’m in XCode 3.1.2. Will this present any serious issues?


#2

Hi,

in the problem you state you might refer to different iOS SDK Versions. XCode Versions should not have any effect, maybe if some templates generated this for you.
These two methods are both delegate methods for UIApplicationDelegate. You can check the developer inside XCode documentation on this.
E.g. Alt-Double-Click on the word UIApplicationDelegate, then click on the Book icon in the top right corner.

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions: (NSDistionary *)launchOptions

whereas

gets normally called when an application did just launch.

I would guess, the first mentioned delegate method will not get called in the normal process of launching an application, if it was not called “due to a remote notification…”.

Cheers,
Richard


#3

The templates that shipped with the iPhone 3.0 SDK use the old style applicationDidFinishLaunching:. If you update to 3.1.3, the templates will use the new application:didFinishLaunchingWithOptions:. Of course, you can go into the templates directory and change it yourself if you wish. (See http://weblog.bignerdranch.com/?p=155 for where the templates are stored.)

The difference between the two is that the latter can receive some additional information about the way it was opened (and any data passed to it). You can only implement one of the two - if you implement both, applicationDidFinishLaunching: is ignored.