Hi,

in an NSDocument based application, is there a reliable way to prevent a document from closing and the app itself from terminating?

I'm having a very difficult time understanding now -canCloseDocumentWithDelegate:shouldCloseSelector:contextInfo: is supposed to work. Contrary to the documentation, the selector that is passed in is this

_something:didSomething:soContinue:

and not as the documentation indicates

document:shouldClose:contextInfo:

Every time I try to make sense of this and the header comments, my head starts spinning.

Some background: In some circumstances, my app needs to update the model in a background task to get its data into a consistent state after some other model properties change. When this happens, I want to prevent the app from terminating and the document from being closed.

I don't want to debate whether this is a good idea/good design or not (I know I could serialize the background task states and restart when the app restarts them but I really really really don't want to do that), I would like to know if there's a reliable way to prevent document closure.

Thanks for any suggestions!

Regards
Markus
--
__________________________________________
Markus Spoettl
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to