Import multiple files in app via iOS11 files app

自闭症网瘾萝莉.ら 提交于 2019-12-04 10:19:08

问题


I am trying to import multiple files from the new iOS11 files app into my app. However when I select two or more files (both of the same type, pdf) in the files app then hit the share button and select my app (copy to myApp) the

- (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options

gets called only once and only the first file of my selection gets imported successfully.

So I tried if this works in some other apps like Dropbox or GoogleDrive but it results in the same behavior. If I choose the iOS Mail app or the Gmail app (after hitting share in the files app), all of my selected files are imported (as attachment). So I think there must be a way to achieve this in my own app also.


回答1:


The files that are being imported by the application are actually copied into a directory called “Inbox” within the apps Documents directory. Do you see multiple files there after importing these? I think it's possible the delegate method is only called once but if you correctly keep track of existing/new files in the Documents Inbox Directory you can correctly import multiple files :)

EDIT: These days the folder is not called 'Inbox' but the name of the folder seems to be the BundleID of your App.



来源:https://stackoverflow.com/questions/47203396/import-multiple-files-in-app-via-ios11-files-app

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