osx - How to prevent a document-based cocoa application to open ANY document? -
recently, document saved caused crash whenever start app. there way prevent doc-based app opening any document, including new empty or last active document(s)? i'd not using osx functionality (outside scope of app), within program.
i think should done through nsdocumentcontroller
somehow, cannot figure out , have had no luck finding answers elsewhere.
so, how tell osx app (through nsdocumentcontroller
) not open documents @ startup?
you're looking functionality defined in nsapplicationdelegate-protocol. following 2 methods give control on happens on app start:
- (bool)applicationshouldhandlereopen:(nsapplication *)theapplication hasvisiblewindows:(bool)flag - (bool)applicationshouldopenuntitledfile:(nsapplication *)sender
see the documentation more.
Comments
Post a Comment