我的应用程序在iMessage UIActivityViewController中 [英] My app inside iMessage UIActivityViewController

查看:131
本文介绍了我的应用程序在iMessage UIActivityViewController中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我在iMessage中打开附加图像并点击共享按钮时,我可以看到第三方应用程序的图标,如Path或Evernote。问题是:如何将我自己的应用添加到此列表中?

When I open attached image inside my iMessage and tap on "Share" button, I can see icons of 3rd party apps like "Path" or "Evernote". The question is: How can I add my own app to this list?

推荐答案

您需要在应用中添加文档类型,而不是URL方案。尝试将以下片段添加到 Info.plist

Instead of a URL scheme you need to add a document type to your app. Try adding the following fragment to your Info.plist:

<key>CFBundleDocumentTypes</key>
<array>
    <dict>
        <key>CFBundleTypeName</key>
        <string>public.jpeg</string>
        <key>CFBundleTypeRole</key>
        <string>Editor</string>
        <key>LSHandlerRank</key>
        <string>Owner</string>
        <key>LSItemContentTypes</key>
        <array>
            <string>public.jpeg</string>
        </array>
    </dict>
</array>

使用此片段(特别是 LSItemContentTypes key)您声明您的应用程序是具有统一类型标识符(UTI) public.jpeg 的文档的编辑器。因为系统声明了这个UTI,所以我认为没有必要在你的应用程序的 Info.plist 中包含UTI声明。

With this fragment (specifically with the LSItemContentTypes key) you declare that your app is an editor for documents that have the Uniform Type Identifier (UTI) public.jpeg. Because this UTI is declared by the system, I believe it is not necessary that you include the UTI declaration in your app's Info.plist.

您可以在Apple文档中找到所有系统声明的UTI,标题为系统声明的统一类型标识符。如果您是UTI的新手,您可能还应阅读Apple文档统一类型标识符概念

You can find all system-declared UTI's in the Apple document titled System-Declared Uniform Type Identifiers. If you are new to UTI you should probably also read the Apple document Uniform Type Identifier Concepts.

最后但并非最不重要的是,不要忘记查阅信息属性列表键参考,找出你应该为Core Foundation密钥 CFBundleTypeRole LSHandlerRank

Last but not least, don't forget to consult the Information Property List Key Reference to find out what you should specify for the Core Foundation keys CFBundleTypeRole and LSHandlerRank.

BTW: 这个优秀的SO答案还有关于使用UTI的详细信息,特别是如果您需要声明自己的应用程序特定的UTI。

BTW: This excellent SO answer also has details about working with UTIs, especially if you ever need to declare your own app-specific UTI.

这篇关于我的应用程序在iMessage UIActivityViewController中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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