문제

Recently, a document that was saved caused a crash whenever I would start my app. Is there a way to prevent a doc-based app from opening any document, including a new empty or the last active document(s)? I'd like to do that not by using OSX functionality (outside the scope of my app), but within my program.

I would think that this should be done through the NSDocumentController somehow, but I cannot figure it out and have had no luck finding answers elsewhere.

So, how to tell an OSX app (through NSDocumentController) to not open any documents at startup?

도움이 되었습니까?

해결책

You're probably looking for functionality that is defined in the NSApplicationDelegate-protocol. Specifically the following two methods give you some control over what happens on app start:

- (BOOL)applicationShouldHandleReopen:(NSApplication *)theApplication hasVisibleWindows:(BOOL)flag
- (BOOL)applicationShouldOpenUntitledFile:(NSApplication *)sender

See the documentation for more.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top