• 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
Telling Auto Save, "No, I'm busy now"
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Telling Auto Save, "No, I'm busy now"


  • Subject: Telling Auto Save, "No, I'm busy now"
  • From: Jerry Krinock <email@hidden>
  • Date: Fri, 29 Jul 2011 20:32:06 -0700

With Auto Save enabled in a document, I find that Lion sometimes wants to break into a sequence of operations to do an Auto Save.  I haven't been able to find any recommendation of how to tell Auto Save "No, I'm busy now".  I just figured out how to do it by overriding saveToURL::::.

It seems to work.  I'd appreciate any criticisms:

- (void)saveToURL:(NSURL *)url
           ofType:(NSString *)typeName
 forSaveOperation:(NSSaveOperationType)saveOperation
completionHandler:(void (^)(NSError *errorOrNil))completionHandler {
    if (saveOperation == NSAutosaveInPlaceOperation) {
        if ([[[NSOperationQueue mainQueue] operations] count] != 0) {
            // "No, I'm busy now"

            // If you don't do this, it hangs forever…
            completionHandler(nil) ;

            return ;
        }
    }

    // Optional…
    [self prepareForSaveOperation:saveOperation] ;

    [super saveToURL:url
              ofType:typeName
    forSaveOperation:saveOperation
   completionHandler:completionHandler] ;
}

_______________________________________________

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: Telling Auto Save, "No, I'm busy now"
      • From: email@hidden
    • Re: Telling Auto Save, "No, I'm busy now"
      • From: Ken Thomases <email@hidden>
  • Prev by Date: Re: Why Don't Cocoa's (Un)Archiving Methods return Errors?
  • Next by Date: Change in animation?
  • Previous by thread: Re: toolbars & toolbar items in lion
  • Next by thread: Re: Telling Auto Save, "No, I'm busy now"
  • Index(es):
    • Date
    • Thread