简体   繁体   English

通过iOS11文件应用程序在应用程序中导入多个文件

[英]Import multiple files in app via iOS11 files app

I am trying to import multiple files from the new iOS11 files app into my app. 我正在尝试将多个文件从新的iOS11文件应用程序导入到我的应用程序中。 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 但是,当我在文件应用中选择两个或多个文件(相同类型,均为pdf)时,点击共享按钮并选择我的应用(复制到myApp),

- (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. 因此,我尝试了这种方法是否在某些其他应用程序(例如Dropbox或GoogleDrive)中有效,但会导致相同的行为。 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). 如果我选择iOS Mail应用程序或Gmail应用程序(在文件应用程序中单击共享后),则所有我选择的文件都将导入(作为附件)。 So I think there must be a way to achieve this in my own app also. 因此,我认为也必须在自己的应用程序中实现此目标。

The files that are being imported by the application are actually copied into a directory called “Inbox” within the apps Documents directory. 由应用程序导入的文件实际上已复制到apps文档目录内的“收件箱”目录中。 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. 编辑:这些天文件夹不被称为“收件箱”,但文件夹的名称似乎是您的应用程序的BundleID。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM