Forum Discussion
iOS File Provider: Never getting file updates
In my iOS app, I am using UIDocumentPickerViewController to pick a file from a OnDrive file provider. I am using startAccessingSecurityScopedResource on the url I receive and register an NSFilePresenter for this url to get change notifications. When I read the contents of the file, I am using file coordination. Reading the initial content is working fine. When now however the file is changed on some other machine, I expect a change notification from the file presenter and I should be able to read the fresh data from the updated file. This is however not working. I am only getting fresh data, when I terminate my app and re-pick the file with the UIDocumentPickerViewController.
Is this a fundamental limitation of the OneDrive file provider under iOS or is there some secret on how to get fresh data while the app is running?
2 Replies
While your implementation using UIDocumentPickerViewController, startAccessingSecurityScopedResource, and NSFilePresenter is technically correct, third-party file providers like OneDrive often do not fully support live updates or change notifications through NSFilePresenter. As a result, updates made on other devices do not automatically trigger refreshes in your app while it's running. The only reliable way to get the latest file version is to re-open the file through the picker, effectively reloading it. This seems to be a known limitation rather than a bug in your implementation.
------------------------------------
Don't forget to mark as solution if my answer suits you- depth42Copper Contributor
Thanks. Do you know if this limitation is documented somewhere? I searched for it and could not find anything.