Not overriding autosaveWithCompletionHandler:
, whenever the document is changed(
[doc updateChangeCount: UIDocumentChangeDone]
) autosaveWithCompletionHandler:
is periodically called.
But if I override this method, it is called only once.
Document has been changed -> Time is passing... -> Overrided method has been called -> Document has been changed -> Time is passing... -> Time is passing... -> Document has been changed -> Time is passing... -> Time is passing...
I make the document change by calling [doc updateChangeCount: UIDocumentChangeDone]
.
(overriding method)
- (void) autosaveWithCompletionHandler: (void (^(BOOL success))completionHandler {
if ([self hasUnsavedChanges]) {
[self saveToURL: self.fileURL forSaveOperation: UIDocumentSaveForOverwriting completionHandler: ^(BOOL success) {
if (success) {
NSLog(@"%@ has been autosaved", [self description]);
completionHandler(YES);
}
else {
NSLog(@"Failed to autosave %@", [self description]);
completionHandler(NO);
}
}];
}
} // autosaveWithCompletionHandler:
Thank you for your reading.