I have a custom UIDocument subclass and implemented loadFromContents:
and contentsForType:
.
To detect that the document was changed on another device, I added a delegate to loadFromContents:
as suggested in the Apple documentation:
- (BOOL)loadFromContents:(id)contents ofType:(NSString *)typeName error:(NSError **)outError {
// load from disk […]
if ([_delegate respondsToSelector:@selector(noteDocumentContentsUpdated:)]) {
[_delegate noteDocumentContentsUpdated:self];
}
return YES;
}
My problem is that when I change the document on another device, I receive document state change notifications (edit_disabled
followed by normal
), but the contents are not reloaded and loadFromContents:
is not called.
The contents definitely were updated on disk. When I manually reopen the document through the UI, I immediately see the latest changes.
Other times it works and loadFromContents:
is called automatically. I can't figure out why it does not work sometimes. Has anybody else seen this problem?