1

I tried it in my extension with context.openURL, but that is blocked by Apple. This is what their documentation says:

Discussion: Each extension point determines whether to support this method, or under which conditions to support this method. In iOS 8.0, only the Today extension point supports this method.

So how do I open my app after selecting to share a file from an email? Dropbox does it and Maps.me does it, so there must be a way.

Edit: sharing extension was not the way to solve this. In the comments, Tom pointed me towards a SO post with the right stuff: How does "Open With" some app in iPhone work?

Community
  • 1
  • 1
Tycho Pandelaar
  • 7,367
  • 8
  • 44
  • 70

1 Answers1

3

Those apps do not have share extensions. I don't know what you're looking at but the premise of your question is incorrect.

If you download Dropbox.app on a Mac and unzip the app package, it contains two extensions:

$ ls Payload/Dropbox.app/PlugIns/
DocPicker.appex/        DropboxTodayView.appex/

If you look in the Info.plist files for those extensions, you'll see that neither one is a share extension. DocPicker.appex is a file provider extension:

            <key>NSExtensionPointIdentifier</key>
            <string>com.apple.fileprovider-ui</string>

DropboxTodayView.appex is a today extension:

    <key>NSExtensionPointIdentifier</key>
    <string>com.apple.widget-extension</string>

Try the same with the Maps.me app, and you'll see it does not contain any extensions at all:

$ ls Payload/maps.me.app/PlugIns
ls: Payload/maps.me.app/PlugIns: No such file or directory

Apple's current restrictions make it impossible to open the containing app from a share extension.

Tom Harrington
  • 69,312
  • 10
  • 146
  • 170
  • Well, if I send myself an email with an KML file in it, I can use the ios's share functionality to 'Open in maps.me' or 'Open in Dropbox'. What do you think they've used? – Tycho Pandelaar Jan 05 '15 at 06:03
  • Not share extensions. The "open with" functionality is described in many places, for example [right here on StackOverflow](http://stackoverflow.com/questions/4517092/how-does-open-with-some-app-in-iphone-work). Now, will you please go and remove your [downvote based on your incorrect assumptions?](http://stackoverflow.com/questions/27506413/share-extension-to-open-host-app/27517554#27517554) – Tom Harrington Jan 05 '15 at 17:45
  • Thank you very much Tom. That comment helped me out. Guess I was too focussed on the extension stuff to search for Open With here in SO. Thanx again. – Tycho Pandelaar Jan 05 '15 at 18:32