Doug Smith
Doug Smith

Reputation: 29326

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.

Upvotes: 0

Views: 138

Answers (1)

Tom Harrington
Tom Harrington

Reputation: 70966

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.

Upvotes: 1

Related Questions