I'm using iCloud to sync specific documents (UIDocument) between devices on iOS. My implementation is currently working, but I'm having trouble wrapping my head around how updating files works. This is how my implementation currently works:
Construct an instance of my UIDocument subclass and save it locally with:
[UIDocument saveToURL]
Send the file to iCloud with
[NSFileManager setUbiquitous]
These steps send my document to iCloud, and I am able to see the file on other devices. My question is how to I update a file? Must I construct a new UIDocument object and save, and setUbiquitous as above? I've tried this with UIDocumentSaveForOverwriting as the save operation in [UIDocument saveToURL], but the setUbiquitous call fails. I've also tried simply saving the local file and watching for metadata query update notifications on other devices, but don't receive any. How can I make an update to a UIDocument and have that change be reflected in iCloud?