• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Preventing Document from closing
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Preventing Document from closing


  • Subject: Preventing Document from closing
  • From: Markus Spoettl <email@hidden>
  • Date: Sat, 04 Apr 2015 09:07:58 +0200

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 (email@hidden)

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:

This email sent to email@hidden


  • Follow-Ups:
    • Re: Preventing Document from closing
      • From: Quincey Morris <email@hidden>
  • Prev by Date: Re: Swift: How to determine if a Character represents whitespace?
  • Next by Date: Re: Preventing Document from closing
  • Previous by thread: Re: Converting colorspace of a CGColor
  • Next by thread: Re: Preventing Document from closing
  • Index(es):
    • Date
    • Thread