• 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
Re: Advice on document handling
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Advice on document handling


  • Subject: Re: Advice on document handling
  • From: John Brownie <email@hidden>
  • Date: Sat, 21 Jun 2014 09:44:43 +1000

Jerry Krinock wrote:
On 2014 Jun 19, at 22:15, John Brownie <email@hidden> wrote:

Looks like I need to keep a local flag for when the document gets changed and when it gets saved.
No, you can just use -[NSDocument isDocumentEdited].

Back when Auto Save first appeared, in OS X 10.7, I too found that it was pestering me too often with autosaves when nothing had changed.  Fortunately, such nuisance autosaves seem to always be cancelable, so it’s easy to fix by overriding -autosaveWithImplicitCancellability:completionHandler:, like this…

- (void)autosaveWithImplicitCancellability:(BOOL)autosavingIsImplicitlyCancellable
                          completionHandler:(void (^)(NSError *errorOrNil))completionHandler {
     if (autosavingIsImplicitlyCancellable) {
         if (![self isDocumentEdited]) {
             // Cancel it.
             completionHandler([NSError errorWithDomain:NSCocoaErrorDomain
                                                   code:NSUserCancelledError
                                               userInfo:nil]) ;
             return ;
         }
     }
… Here, I add a save operation to my document's operation queue.
     … If you don't save that way, probably just invoke super here.
}

That's not going to work for my case. I have a complex document bundle, and I'm trying to figure out which files within the package have unsaved changes, and it looks like there's no support for that model in NSDocument.

John
--
John Brownie, email@hidden or email@hidden
Summer Institute of Linguistics      | Mussau-Emira language, Mussau Is.
Ukarumpa, Eastern Highlands Province | New Ireland Province
Papua New Guinea                     | Papua New Guinea
_______________________________________________

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: Advice on document handling
      • From: Quincey Morris <email@hidden>
References: 
 >Advice on document handling (From: John Brownie <email@hidden>)
 >Re: Advice on document handling (From: Graham Cox <email@hidden>)
 >Re: Advice on document handling (From: John Brownie <email@hidden>)
 >Re: Advice on document handling (From: John Brownie <email@hidden>)
 >Re: Advice on document handling (From: Graham Cox <email@hidden>)
 >Re: Advice on document handling (From: John Brownie <email@hidden>)
 >Re: Advice on document handling (From: Jerry Krinock <email@hidden>)

  • Prev by Date: Re: Advice on document handling
  • Next by Date: Re: Advice on document handling
  • Previous by thread: Re: Advice on document handling
  • Next by thread: Re: Advice on document handling
  • Index(es):
    • Date
    • Thread