Items in File provider extension for ios 11

社会主义新天地 提交于 2019-12-06 08:22:26

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!