7

我希望我的应用程序出现在UIActivityViewController文本中,在其他应用程序中。例如,当从 Notes 应用程序共享时,如下所示。

在此处输入图像描述

将以下内容添加到 Info.plist 并没有产生任何可见的结果(在 Notes、Evernote 和 Simplenote 中):

<key>CFBundleDocumentTypes</key>
<array>
    <dict>
        <key>CFBundleTypeIconFiles</key>
        <array>
            <string>icon-text-57.png</string>
            <string>icon-text-72.png</string>
            <string>icon-text-114.png</string>
        </array>
        <key>CFBundleTypeName</key>
        <string>Text</string>
        <key>LSHandlerRank</key>
        <string>Alternate</string>
        <key>LSItemContentTypes</key>
        <array>
            <string>public.text</string>
            <string>public.plain-text</string>
            <string>public.utf8-plain-text</string>
            <string>public.utf16-external-plain-​text</string>
            <string>public.utf16-plain-text</string>
            <string>public.rtf</string>
        </array>
    </dict>
</array>

这可能吗?如何?

4

2 回答 2

8

简短的回答:你不能。

目前,您无法将您的应用程序添加到其他应用程序UIActivityViewControllers中,除非您创建自己的 UTI 并且应用程序(Notes、Evernote 和 Simplenote)将代码添加到他们的应用程序中以显示您的应用程序。

但是,您可能指的UIDocumentInteractionController是不同的 ,您可以在那里添加您的应用程序,我相信您这样做是正确的。

你正在尝试的东西都是UIActivityViewControllers这样,无论你多么努力,你的应用程序都不会出现在那里。

快速添加说明:区分 isUIActivityViewControllers和 a 的一个好方法UIDocumentInteractionController是查看其中是否出现“Dropbox”。根据我的经验,Dropbox 应用程序有一个“包罗万象”的 UTI,并且可以获取任何文件,因此它通常出现在几乎所有UIDocumentInteractionController的文件中。当然,您需要安装该应用程序

于 2014-02-12T21:10:17.723 回答
1

plist错了,看看这个答案:为什么我的 iOS 应用程序没有出现在其他应用程序的“打开方式”对话框中?但对我来说,你似乎还没有LSHandlerRank在你的plist.

另外:确保您遵循 Apple 自己的文档:https ://developer.apple.com/library/ios/documentation/FileManagement/Conceptual/DocumentInteraction_TopicsForIOS/Articles/RegisteringtheFileTypesYourAppSupports.html

于 2014-02-10T20:30:14.620 回答