iOS Apps间分享数据
发布日期:2022-03-18 08:27:37 浏览次数:41 分类:技术文章

本文共 2375 字,大约阅读时间需要 7 分钟。

iOS Apps间分享数据

请参考:

总的来说有如下几种:

  • UIDocumentInteractionController
  • UIActivityViewController
  • Shared Keychain Access
  • Custom URL Scheme
  • Web Service
  • UIPasteboard + URL Scheme

UIDocumentInteractionController

请参考:

UIDocumentInteractionController文档见

注册APP支持的文件类型(Registering the File Types Your App Supports)

在Info.plist中使用CFBundleDocumentTypes键,对应的为array,可以包括如下的key:

  • CFBundleTypeName specifies the name of the document type(文件类型).
  • CFBundleTypeIconFiles is an array of filenames for the image resources to use as the document’s icon(图标).
  • LSItemContentTypes contains an array of strings with the UTI types that represent the supported file types in this group(UTI数组).
  • LSHandlerRank describes whether this application owns the document type or is merely able to open it(是否拥有or仅仅是打开).

UTI类型请参考:

打开支持的文件类型(Opening Supported File Types)

The system may ask your application to open a specific file and present it to the user. This typically occurs because another application encountered the file and used a document interaction controller to handle it. You receive information about the file to be opened in the application:willFinishLaunchingWithOptions: or application:didFinishLaunchingWithOptions: method of your application delegate. If your application handles custom file types, you must implement this delegate method (instead of the applicationDidFinishLaunching: method) and use it to initialize your application.

The options dictionary passed to the application:willFinishLaunchingWithOptions: or application:didFinishLaunchingWithOptions: method contains information about the file to be opened. Specifically, your application should look in this dictionary for the following keys:

  • UIApplicationLaunchOptionsURLKey contains an NSURL object that specifies the file to open.
  • UIApplicationLaunchOptionsSourceApplicationKey contains an NSString with the bundle identifier of the application that initiated the open request.
  • UIApplicationLaunchOptionsAnnotationKey contains a property list object that the source application wanted to associate with the file when it was opened.
    If the UIApplicationLaunchOptionsURLKey key is present, your application must open the file referenced by that key and present its contents immediately. You can use the other keys in the dictionary to gather information about the circumstances surrounding the opening of the file.

保存共享的文件

请参考:

参考

  • 列有常见的配置信息

转载地址:https://windzen.blog.csdn.net/article/details/50847902 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!

上一篇:iOS简单手势解锁
下一篇:iOS事件响应链介绍

发表评论

最新留言

第一次来,支持一个
[***.219.124.196]2024年03月07日 23时09分33秒

关于作者

    喝酒易醉,品茶养心,人生如梦,品茶悟道,何以解忧?唯有杜康!
-- 愿君每日到此一游!

推荐文章

mysql select同时update_MySQLSELECT同时UPDATE同一张表 2019-04-21
mysql删除后数据库没变化_mysql之delete删除记录后数据库大小不变 2019-04-21
net mysql start3534_MySQL 5.7.14 net start mysql 服务无法启动-“NET HELPMSG 3534” 的奇怪问题... 2019-04-21
pta两个有序链表的合并_7-1 两个有序链表序列的合并 (20分) --- 内存问题再叙 2019-04-21
qpython3安装lxml_在python的lxml中使用xml目录? 2019-04-21
java 幂取模_快速幂取模算法 2019-04-21
java build path jre_java-如何在安装了jre 7后为Jre 6设置路径? 2019-04-21
java上传下载源码_javaweb简单实现文件上传与下载源代码 2019-04-21
java socket udp 广播_1.Java 的屏幕广播(基于UDP),2.多线程下载器 2019-04-21
java控制热敏打印机的例子.rar_stm32控制热敏打印机 2019-04-21
java clone equals_(原)java中对象复制、==、equals 2019-04-21
php7 memcached.exe,PHP7 下安装 memcache 和 memcached 扩展 2019-04-21
计算机二级java技巧,计算机二级报java难考吗 2019-04-21
php foreach 数据库,php – 使用foreach将数据库检索的数据排列在HTML表中 2019-04-21
拉格朗日matlab编程例题,Matlab习题讲解.doc 2019-04-21
case是不是php语言关键字,PHP语言 switch 的一个注意点 2019-04-21
linux php mkdir失败,linux – mkdir错误:参数无效 2019-04-21
config.php渗透,phpMyAdmin 渗透利用总结 2019-04-21
java list 合并 重复的数据_Java ArrayList合并并删除重复数据3种方法 2019-04-21
android volley 上传图片 和参数,android - 使用android中的volley将图像上传到multipart中的服务器 - 堆栈内存溢出... 2019-04-21