Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to launch a parent iOS App from its App Extension

Does any one know how to launch the parent app from the app extension's view controller?

I just want to launch the main app from its app extension.

like image 990
loganathan Avatar asked Sep 08 '14 15:09

loganathan


People also ask

How do app extensions work iOS?

iOS Share extensions automatically employ the containing app's icon. If you provide a separate icon in your Share extension target, Xcode ignores it. For all other app extension types, you must provide an icon that matches the containing app's icon.

How do app extensions work?

App extensions showcase your mobile or tablet app by showing a link to your app below your ad. Clicking this link leads you to your app's description in the app store (Google Play or the Apple App Store). Clicking on your ad's headline will still lead to your website.

What is iOS app extension?

App extensions let you extend custom functionality and content beyond your app and make it available to users while they're interacting with other apps or the system.

How do I launch an extension?

In most cases, an extension launches when a user chooses it from an app’s UI or from a presented activity view controller. An app that a user employs to choose an app extension is called a host app. A host app defines the context provided to the extension and kicks off the extension life cycle when it sends a request in response to a user action.

How does an app extension work?

The extension displays its view within the context of the host app and then uses the items it received in the host app’s request to perform its task (in this example, the extension receives the selected text). In step 3 of Figure 2-1, the user performs or cancels the task in the app extension and dismisses it.

How do I share code between an app and an extension?

You can create an embedded framework to share code between your app extension and its containing app. For example, if you develop an image filter for use in your Photo Editing extension as well as in its containing app, put the filter’s code in a framework and embed the framework in both targets.

How do I use JavaScript in an iOS App Extension?

When your app extension starts, use the NSItemProvider class to get the results returned by the execution of the JavaScript file. In an iOS app extension, pass values to the JavaScript file if you want Safari to modify the webpage when your extension completes its task. (You use the NSItemProvider class in this step, too.)


1 Answers

In the WWDC session Creating Extensions for iOS and OS X, Part 1 around the 22 minute mark the say to use the openURL:completionHandler: method from the UIViewController's extensionContext to open a custom URL scheme

[self.extensionContext openURL:[NSURL URLWithString:@"your-app-custom-url-scheme://your-internal-url"]
             completionHandler:nil];
like image 186
Karl Monaghan Avatar answered Sep 17 '22 13:09

Karl Monaghan