On Wed, Sep 15, 2010 at 6:07 PM, Jerry Krinock <[email protected]> wrote:
> - (void)applicationWillFinishLaunching:(NSNotification*)aNotification {
>    NSRunAlertPanel(@"Hello",
>                    @"A crash is coming soon.",
>                    @"OK",
>                    nil,
>                    nil) ;
> }

There's no runloop running yet when -applicationWillFinishLaunching:
is called. You can see this for yourself by installing a
CFRunLoopObserver in main(), before calling NSApplicationMain. As
such, this is a very sensitive point in the app's life cycle. Among
other things, AppKit's automatically-installed autorelease pool hasn't
been installed yet (which you can verify by putting a call to the
undocumented NSPopAutoreleasePool function in
-applicationWillFinishLaunching:). That's why you're getting all the
autorelease pool warnings on the console.

Then NSRunAlertPanel is going to run the app in a modal mode before
the app has finished setting itself up. I'm not surprised that doesn't
work.

What is there that you can't do in -applicationDidFinishLaunching:?

--Kyle Sluder
_______________________________________________

Cocoa-dev mailing list ([email protected])

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to