Raghav7890 Raghav7890 - 3 months ago 83
Swift Question

Items in File provider extension for ios 11

I have an app with file provider extension in it. I tried giving support to the new file app with the ios 11 using this link

I did what is instructed in this but no item is getting displayed. I have added this

NSExtensionFileProviderSupportsEnumeration = YES
in my plist as well.

is my NSFileProviderEnumerator class where
is a NSFileProviderItem. inside my enumerator class I have this,

func enumerateItems(for observer: NSFileProviderEnumerationObserver, startingAt page: NSFileProviderPage) {
observer.didEnumerate([ProviderItem(name: "raghav", type: "public.folder", identifier: "12334444", parentId: "-1"), ProviderItem(name: "panth", type: "public.folder", identifier: "12334444", parentId: "-1")])
var myInt = 100
let myIntData = Data(bytes: &myInt, count: MemoryLayout.size(ofValue: myInt))
observer.finishEnumerating(upTo: NSFileProviderPage(rawValue: myIntData))

gets called but the view is not getting populated

Am I missing something !!

Answer Source

Finally I figured out the problem here, that if we want to show the files in the root page the NSFileProviderItem requires it's parent_id as NSFileProviderItemIdentifier.rootContainer. Setting this solved my problem

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download