Changes

Jump to: navigation, search

Managing Files using the iOS 8 UIDocument Class

30 bytes added, 04:27, 10 November 2016
Conflict Resolution and Document States
== Conflict Resolution and Document States ==
<htmlet>adsdaqbox_flow</htmlet>
Storage of documents using iCloud means that multiple instances of an application can potentially access the same stored document consecutively. This considerably increases the risk of a conflict occurring when application instances simultaneously make different changes to the same document. One option is to simply let the most recent save operation overwrite any changes made by the other application instances. A more user friendly alternative, however, is to implement conflict detection code in the application and present the user with the option to resolve the conflict. Such resolution options will be application specific but might include presenting the file differences and letting the user choose which one to save, or allowing the user to merge the conflicting file versions.
• '''UIDocumentState.progressAvailable''' – The current progress of the document download is available via the progress property of the document object.
Clearly one option for detecting conflicts is to periodically check the documentState property for a UIDocumentState.inConflict value. That said, it only really makes sense to check for this state when changes have actually been made to the document. This can be achieved by registering an observer on the UIDocumentStateChangedNotification notification. When the notification is received that the document state has changed the code will need to check the documentState property for the presence of a conflict and act accordingly.
== The UIDocument Example Application ==

Navigation menu