7

I would like my app to appear in the UIActivityViewController for text, in other apps. For example, when sharing from the Notes app as shown below.

enter image description here

Adding the following to the Info.plist didn't produce any visible results (in Notes, Evernote and 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>

Is this possible? How?

hpique
  • 119,096
  • 131
  • 338
  • 476

2 Answers2

8

Short answer: you can't.

Currently, you cannot add your app into other UIActivityViewControllers, unless you create your own UTI and the app ( Notes, Evernote and Simplenote) add code into their app to show yours.

What you are likely referring to, though, is the UIDocumentInteractionController, which is different, and there you CAN add your app, and I believe you are doing that correctly.

The things you are trying are all UIActivityViewControllers so no matter how hard you try, your app will not show up there.

Quick note to add: A good way to distinguish between is UIActivityViewControllers and a UIDocumentInteractionController is to see if "Dropbox" comes up in it. From my experience the Dropbox app has a "catch-all" UTI and can take any file so it usually comes up in nearly all UIDocumentInteractionController's. Of course, you'll need to have the app installed

Jack
  • 16,677
  • 8
  • 47
  • 51
  • 1
    Is this still true? Maybe I'm misunderstanding your answer, but I see "Save to Dropbox" in a plain `UIActivityViewController`, on the second row of icons. I'd like my app to appear alongside it, and it does with a `UIDocumentInteractionController`, but not alongside Dropbox in a `UIActivityViewController`. – Tim Arnold Sep 08 '15 at 16:07
  • 1
    @TimCamber Good point. This info is outdated as of iOS 8, where Share Extensions were added and is the correct way. I'll update the answer. – Jack Sep 09 '15 at 14:57
1

You're plist is wrong, see this answer: Why is my iOS app not showing up in other apps' "Open in" dialog? but to me it looks like you haven't yet set the LSHandlerRankin your plist.

Also: make sure you follow Apple's own Documentation: https://developer.apple.com/library/ios/documentation/FileManagement/Conceptual/DocumentInteraction_TopicsForIOS/Articles/RegisteringtheFileTypesYourAppSupports.html

Community
  • 1
  • 1
virindh
  • 3,775
  • 3
  • 24
  • 49
  • Wait! why are you finishing your array right after CFBundleTypeIconFiles ? – virindh Feb 10 '14 at 20:39
  • Xcode added that. Adding icons doesn't appear to make any difference. I'll edit the question. – hpique Feb 10 '14 at 20:45
  • Try, defining your type further by using plain text: public.plain-text – virindh Feb 10 '14 at 20:53
  • Wait, I think I've solved it, have you tried i with any other app other than notes? I don't believe notes "shares" plain text. How do I know that? I just tried sharing something from notes and no other app could open it and I know I have apps that can open plain text. – virindh Feb 10 '14 at 20:59
  • Tried with a few more (see edited question), after restarting the device. No difference. – hpique Feb 10 '14 at 20:59
  • I'm also trying with Evernote and Simplenote. – hpique Feb 10 '14 at 21:02
  • any tutorial? Thanks in advance – famfamfam Mar 27 '21 at 09:33