如何在同一个iOS设备中将文件从一个应用程序传输到另一个应用程序? [英] How can I transfer files from one application to another in the same iOS device?

查看:336
本文介绍了如何在同一个iOS设备中将文件从一个应用程序传输到另一个应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在编写一个iOS应用程序,用于将同一设备上的另一个应用程序保存的文件转换为另一种格式。如何在同一设备中将文件从一个应用程序传输到另一个应用程序?请注意,文件是非文本文件。

I am writing an iOS application that performs conversion of a file saved by another application on the same device to another format. How can I transfer files from one application to another in the same device? Note that the files are non-textual files.

推荐答案

UIDocumentInteractionController

基本上它的工作原理如下:

Basically it works like this:


  1. 能够处理类型为XYZ的文件

  2. App 2实现 UIDocumentInteractionController ,并且将给用户选项将文件发送到App1 (我相信这必须是用户激活的)

  3. App 1 implements - (BOOL)application:openURL:sourceApplication:annotation:处理传输的文件,该文件将保存在您的 Documents / Inbox 目录中。从那里你可以复制文件在其他地方,然后处理它,确保你清理掉了保存在收件箱文件夹中的原始文件。

  1. App 1 registers as being able to handle files of type XYZ
  2. App 2 implements UIDocumentInteractionController and will give users the options to "send the file to App1" (I believe this has to be user activated)
  3. App 1 implements -(BOOL)application:openURL:sourceApplication:annotation: and deals with the transferred file which will be saved in your Documents/Inbox directory. From there you can copy the file elsewhere and then manipulated it, making sure you clean up by getting rid of the original one saved on the Inbox folder.

可供参考类别此处

可提供文档交互计划指南这里

Document interaction programming guide available here

这篇关于如何在同一个iOS设备中将文件从一个应用程序传输到另一个应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆