通过iOS11文件应用程序在应用程序中导入多个文件 [英] Import multiple files in app via iOS11 files app
问题描述
我正在尝试将多个文件从新的iOS11文件应用程序导入到我的应用程序中.但是,当我在文件应用程序中选择两个或多个文件(相同类型,均为pdf)时,请点击共享按钮并选择我的应用程序(复制到myApp)
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.
因此,我尝试了这种方法是否在某些其他应用(例如Dropbox或GoogleDrive)中有效,但会导致相同的行为.如果我选择iOS Mail应用程序或Gmail应用程序(在文件应用程序中单击共享后),则所有我选择的文件都将被导入(作为附件).因此,我认为也必须在自己的应用程序中实现这一目标.
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.
推荐答案
由应用程序导入的文件实际上被复制到apps文档目录中的收件箱"目录中.导入这些文件后,您在其中看到多个文件吗?我认为有可能只调用一次委托方法,但是如果您正确跟踪文档收件箱目录中的现有文件/新文件,则可以正确导入多个文件:)
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 :)
如今,该文件夹不被称为收件箱",但该文件夹的名称似乎是您的应用程序的BundleID.
These days the folder is not called 'Inbox' but the name of the folder seems to be the BundleID of your App.
这篇关于通过iOS11文件应用程序在应用程序中导入多个文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!