Re: Is this a bug in AppDelegate?


Quincey Morris
 

On Aug 4, 2018, at 22:30 , Peter Teeson via Groups.Io <peter.teeson@...> wrote:

I expected that the app would not open an untitled file because
applicationOpenUntitledFile returned NO. 
But an untitled file was in fact opened in a window.

I can’t swear to it, but I’m pretty certain this is a result of state restoration. Assuming you had at some previous point created an untitled window, then state restoration will recreate it at next launch, without going through applicationOpenUntitledFile — because it’s not really creating a new document, but re-opening an autosaved one, which just happens to be called “Untitled”.

Try running it with the scheme option to prevent state restoration, and I suspect you’ll see the expected behavior.

Join cocoa@apple-dev.groups.io to automatically receive all group messages.