如何在同一个iOS设备中将文件从一个应用程序传输到另一个应用程序?

编程入门 行业动态 更新时间:2024-10-10 06:14:31
本文介绍了如何在同一个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:

  • 能够处理类型为XYZ的文件
  • App 2实现 UIDocumentInteractionController ,并且将给用户选项将文件发送到App1 (我相信这必须是用户激活的)
  • App 1 implements - (BOOL)application:openURL:sourceApplication:annotation:处理传输的文件,该文件将保存在您的 Documents / Inbox 目录中。从那里你可以复制文件在其他地方,然后处理它,确保你清理掉了保存在收件箱文件夹中的原始文件。
  • App 1 registers as being able to handle files of type XYZ
  • App 2 implements UIDocumentInteractionController and will give users the options to "send the file to App1" (I believe this has to be user activated)
  • 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设备中将文件从一个应用程序传输到另一个应用程序?

    本文发布于:2023-11-09 23:38:20,感谢您对本站的认可!
    本文链接:https://www.elefans.com/category/jswz/34/1573757.html
    版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
    本文标签:应用程序   中将   文件   设备   在同一个

    发布评论

    评论列表 (有 0 条评论)
    草根站长

    >www.elefans.com

    编程频道|电子爱好者 - 技术资讯及电子产品介绍!