iOS11 Files App not persisting Files Metadata

We are working on iOS 11 Files App extension, we are able to show folders, files & thumbnails correctly inside Files App. However when it comes to storing metadata of a file such as File Tags(Colors), Folder favorites which are set by user we are facing a problem. Though we are setting the Working set but this is not persisted during Files App restarts. It shows Files tags from my File Provider Extension briefly in Recent items in Files App, however it disappears afterwards. These tags meta data is not persisted after Files app restarts as well. In WWDC '17 Video we could see the folks mentioning about DB, Who has to create and maintain this DB?

When ever I relaunch Files App I could see some DB query going on as below. However our provider never listed in the results of this DB Query.

Reusing collector for descriptor with query (((FieldMatch(kMDItemContentTypeTree, "public.item")))) && ((kMDItemIsTrashed != "1")) && ((kMDItemFileProviderID == "*" && _kMDItemBundleID != "com.apple.fileprovider.fileproviderd*")) && (kMDItemUserTags == "*")

Is there any persistence logic our File Provider Extension is missing? Does our File Provider Extension has to create & maintain this DB? or it is just ONE DB for Files App and extensions can write into it?

I am referring to the talk from below URL

https://developer.apple.com/videos/play/wwdc2017/243/

Accepted Reply

I am able to figure the issue here, answering here just in case anyone else might need it.


Each File provider is expected to maintain its own Database for all the offline files (Which are Recents, Tags etc.). When ever files App is launched it calls provideURL() method which will be overridden by File providers. Once we get this call we have to query our DB for offline items and provide URLs for the same.

Also Working set Sync Anchor should be maintained correctly otherwise we wont get call backs to add items to Files App working set.

Replies

I am able to figure the issue here, answering here just in case anyone else might need it.


Each File provider is expected to maintain its own Database for all the offline files (Which are Recents, Tags etc.). When ever files App is launched it calls provideURL() method which will be overridden by File providers. Once we get this call we have to query our DB for offline items and provide URLs for the same.

Also Working set Sync Anchor should be maintained correctly otherwise we wont get call backs to add items to Files App working set.