Re: Very Simple Demo: Modal Dialog causes later Modal Session to Crash
Re: Very Simple Demo: Modal Dialog causes later Modal Session to Crash
- Subject: Re: Very Simple Demo: Modal Dialog causes later Modal Session to Crash
- From: Kyle Sluder <email@hidden>
- Date: Wed, 15 Sep 2010 19:30:34 -0700
On Wed, Sep 15, 2010 at 7:11 PM, Jerry Krinock <email@hidden> wrote:
> Anything that I want to happen before a document opens, in case the app is launched by doubleclicking a document.
I think the right pattern to use here would be to set a flag in
-applicationDidFinishLaunching: or some later point. Until that flag
is set, return NO from -applicationShouldOpenUntitledFile:.
@interface MyAppDelegate : NSObject <NSApplicationDelegate> {
BOOL _shouldOpenUntitled;
}
@end
@implementation MyAppDelegate
- (BOOL)applicationShouldOpenUntitledFile:(NSApplication *)myApp; {
return _shouldOpenUntitled;
}
- (void)applicationDidFinishLaunching:(NSNotification *)aNote; {
if (DoStuffBeforeFirstDocument() == YES) {
_shouldOpenUntitled = YES;
[[NSDocumentController sharedDocumentController] newDocument:nil];
}
}
@end
> Is it correct to say that one should not do "GUI Things" or "AppKit Stuff" in -applicationWillFinishLaunching: ?
I would say that is a safe rule to live by.
--Kyle Sluder
_______________________________________________
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