I'm thoroughly confused about how to control document opening in Lion.

My app can optionally show a dialog at startup instead of opening a new 
'untitled' document. The dialog displays templates, in the same manner as 
Pages, etc. When this dialog is shown, as controlled by a user default, I need 
to suppress the opening of the 'untitled' document. In 10.6 and earlier I did 
this using the app delegate method:

- (BOOL) applicationShouldOpenUntitledFile:(NSApplication*) sender


Which worked fine. However, on Lion this isn't called reliably. It sometimes 
is, and sometimes isn't, and I am having a hard time figuring out when to 
expect it, or when I should display the dialog (I do it in 
-applicationDidFinishLaunching:)

Even when -applicationShouldOpenUntitledFile: returns YES, I sometimes DON'T 
get an untitled document. (I always do on 10.6). At other times, I show my 
dialog, and end up with TWO documents also opening - an untitled one, and 
whatever I was working on in the previous session.

Is this whole mess borked in 10.7, or has it just been superseded? How should 
one go about correctly allowing a dialog to be shown at startup in the new 
regime? I've been over the latest documentation and release notes but to be 
honest I'm none the wiser. Please, can somebody explain the opening sequence in 
words of one syllable such that a mere mortal can make sense of it!!

--Graham


_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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 arch...@mail-archive.com

Reply via email to