Telling Auto Save, "No, I'm busy now"
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