问题
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.
ProviderEnumerator
is my NSFileProviderEnumerator class where ProviderItem
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))
}
observer.didEnumerate()
gets called but the view is not getting populated
Am I missing something !!
回答1:
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
来源:https://stackoverflow.com/questions/46563336/items-in-file-provider-extension-for-ios-11