Search code examples
ios8mobile-safarisafari-extensionios8-extensionios8-share-extension

Is it possible to create an iOS 8 sharing extension that opens the website in its app?


I'm building an app, and I was curious if there's a way to open the app when you're on the website through the iOS Safari extension. So, if I'm on a post I'd tap the app icon in the share sheet and I'd pass that to the app to load the post in the app.

I know the Bing app can translate the current website and inject directly into the DOM, so I was wondering what custom logic you can implement.


Solution

  • There's really no way to open the app from this kind of extension. Extensions can't access [UIApplication sharedApplication], so they can't call openURL:. There's an openURL:completionHandler: method on NSExtensionContext, but it only works in "today" extensions. Share extensions can display a fully custom UI and can save data that's available to their containing app, but they can't actually open that app.