Changes

Jump to: navigation, search

Managing Files using the iOS 8 UIDocument Class

30 bytes added, 17:20, 23 December 2015
Conflict Resolution and Document States
== Conflict Resolution and Document States ==
<google>ADSDAQBOX_FLOW</google>
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.EditingDisabled''' – The document is busy and is not currently safe for editing.
Clearly one option for detecting conflicts is to periodically check the documentState property for a UIDocumentStateInConflict 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