Does anyone have practical examples of using NSFileCoordinatorMBS and related items from the MBS plugins, to
- access a list of files matching a wildcard pattern from iCloud storage,
- select one,
- and retrieve it
The entire ‘documentation’ seems to be a copy and paste from Apple docs but is all but meaningless to me without sample code:
If you invoke addFilePresenter: you have to do a balancing invocation of removeFilePresenter before the file presenter is deallocated, even in a garbage-collected application.
If your application reads an item and then registers a file presenter for it there is a possible race condition in which between those two steps another process does coordinated reading or writing of the item, without any messages sent to your not-quite-registered file presenter. This can leave your file presenter ignorant of the fact that what it knows about the item it just read is already out of date, or under the misconception that just because it hasn’t received a relinquish… method it owns the item. To avoid that race condition you can invoke addFilePresenter in the same block that you pass to coordinateReadingItemAtURL to read what the file presenter will present