开发者

Don't open an untitled file if OS X Lion will reopen a document

I've got a Core Data Document Based App (OS X) that opens an untitled document if the user hasn't specified a document to open on startup. Now that Lion reopens documents on launch, I need to know how to prevent this untitled document from opening if there are documents to be reopened from the last time the program ran.

Previously, I did some checking in

- (BOOL) applicationShouldOpenUntitledFile: (NSApplication *) sender

and returned YES开发者_如何学C or NO appropriately. What should I check now to prevent an untitled document from being opened when there are documents to restore?


From Lion's release notes:

As part of the restorable windows feature, the application delegate may not be asked to create an Untitled window at launch in some circumstances. This was found to cause crashes in certain apps, so these apps will maintain 10.6 behavior of more often opening Untitled windows. When these apps are recompiled on 10.7, they will acquire the 10.7 behavior. For maximum compatibility, do not depend on being asked to create an Untitled window at launch.

Basically, they're saying "it may not work and we're not going to say why, so it's best not to rely on it at all."

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜