File Provider Extension Conflict Resolution

Hi all, i am trying to implement File Provider Extension. I have some questions about conflict resolution

Same file is changed at user local and remote storage before it's synced. File has 2 different version at user local and remote storage. After trigger a new enumeration by calling signalEnumerator for the extension, I want to move user's local version to new conflicted copy (with new itemIdentifier: NSFileProviderItemIdentifier) and import remote storage version to user local (with current itemIdentifier: NSFileProviderItemIdentifier). Then users local version should uploaded to remote storage server with new conflicted copy name

Any suggestion about this scenario? Or any documentation about conflict resolution

Answered by Engineer in 830044022

You should receive the local content change as a modifyItem call to your extension. In the implementation of that call, you can detect the conflict, return the new state for that itemIdentifier on the completion handler (including changing the filename property of the NSFileProviderItem argument - the system will propagate the change back to disk), as well as return a new contentVersion, so that the system fetches the remote contents that you've assigned to that existing identifier. And then also push a working set change for the conflict copy that you generate in the modifyItem completion handler, with the new itemIdentifier, and the contentVersion corresponding to the user's locally edited version.

Accepted Answer

You should receive the local content change as a modifyItem call to your extension. In the implementation of that call, you can detect the conflict, return the new state for that itemIdentifier on the completion handler (including changing the filename property of the NSFileProviderItem argument - the system will propagate the change back to disk), as well as return a new contentVersion, so that the system fetches the remote contents that you've assigned to that existing identifier. And then also push a working set change for the conflict copy that you generate in the modifyItem completion handler, with the new itemIdentifier, and the contentVersion corresponding to the user's locally edited version.

File Provider Extension Conflict Resolution
 
 
Q