How to stop the termination of the application
I know that my question perhaps sound's a bit confusing, but I wan't to stop the terminating of a Cocoa Mac Os X application. I don't know if there is an API to that. And I also don't know how to do that.
My idea was to call an NSAlert
inside the applicationWillTerminate:
method. But that doesn't stop the termination of the App.
Another possibility would be to use a while loop, which doesn't stop, but this isn开发者_如何学编程't any good practice, because it uses a lot of CPU and doesn't add any possibility of keeping the rest of the app running.
Please give me an idea, how I could solve this problem.
Much times thanks. =D
Implement the application delegate method applicationShouldTerminate:
. Return either NSTerminateCancel
or NSTerminateLater
. If you return NSTerminateLater
then you should eventually call replyToApplicationShouldTerminate:
with your final answer.
精彩评论