Re: Defer opening documents until app is fully inited
Re: Defer opening documents until app is fully inited
- Subject: Re: Defer opening documents until app is fully inited
- From: Jerry Krinock <email@hidden>
- Date: Sat, 20 Sep 2014 06:51:32 -0700
On 2014 Sep 19, at 09:12, Mills, Steve <email@hidden> wrote:
> Our app init (called from applicationWillFinishLaunching) needs to put up some modal dialogs.
I’m surprised that works. I think I was in a similar situation about 4 years ago.
http://www.cocoabuilder.com/archive/cocoa/293279-very-simple-demo-modal-dialog-causes-later-modal-session-to-crash.html?q=applicationWillFinishLaunching+Krinock#293279
Or if Bertrand’s site ever goes away,
http://lists.apple.com/archives/Cocoa-dev/2010/Sep/msg00448.html
> When one of these modals is dismissed, NSApplication proceeds to call application:openFiles:, but we haven't returned from applicationWillFinishLaunching yet, so we're not ready. I'm sure others have needed to work around this. What's the best way?
To summarize, what worked for me is to
• Create my dialogs or whatever in an doEarlyChores method.
• Override -application:openFile: to invoke the doEarlyChores method and return NO.
• Also invoke the doEarlyChores method early in -applicationDidFinishLaunching.
• Put a lockout in doEarlyChores so it will only do its chores once.
On 2014 Sep 19, at 10:42, Mills, Steve <email@hidden> wrote:
> And we're too late in the cycle now to make such a radical change.
Life is hard, Steve. That reminds of what a wise manager told our team at times of crisis: “There’s never enough time to do it right [the first time], but there will be always enough time to do it over [when the product fails in the field].” :))
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden