Custom App Launch

Navigation:  Knowledge Base > Page Editor > Actions > System Control > Call External App >

Custom App Launch

Previous pageReturn to chapter overviewNext page

 

Registering a Custom URL Scheme

 

Step 1: The first step is to create a custom URL scheme – start by locating and clicking on the project info.plist in the "Xcode Project Navigator". With the plist displayed in the right pane, right click on the list and select Add Row:

 

From the list presented scroll down and select URL types.

 

urlScheme2

 

Step 2: Open the directional arrow and one can see "Item 0", a dictionary entry. Expand "Item 0" to see "URL Identifier", a string object. This string is the name for the custom URL scheme user is defining. It’s recommended to ensure uniqueness of the name by reversing domain name such as com.yourCompany.yourApp.

 

urlScheme2a

 

Step 3: Tap on "Item 0" and add a new row, select "URL Schemes" from the drop-down and tap Enter to complete the row insert.

 

urlScheme2b

 

Step 4: Notice URL Schemes is an array, allowing multiple URL schemes to be defined for an application.

 

urlScheme2c

 

Step 5: Expand the array and tap on "Item 0". This is where user will define the name for the custom URL scheme. Enter just the name, do not append :// – for instance, if you enter iOSDevApp, your custom url will be iOSDevApp://

 

urlScheme2d

 

Step 6: The complete definition looks like as shown in the figure below.

 

urlScheme2e

 

Calling Custom URL Scheme from Safari

 

With the URL scheme defined, we can run a quick test to verify the app. The app can be called as expected using the URL.

Create a barebones UI to identify the app with the custom URL.

The app contains a UILabel with the text “App With Custom URL.”

Download source for creating iOS App with Custom URL Scheme.

 

urlScheme4a

 

Using the simulator, here’s how to call the app:

 

- Run the application from within Xcode

- Once installed, the custom URL scheme will now be registered

- Close the app via the Hardware menu in simulator and choose Home

- Start Safari

- Enter the URL scheme defined previously in the browser address bar (see below)

 

urlScheme32

 

At this point Safari will close and the app will be brought to the foreground calling an iPhone application using a custom URL scheme.

 

Calling Custom URL Scheme from Another iPhone App

 

Create a very simple iPhone application with a UILabel and a UIButton – the former shows a message that this is the app that will call another app via a custom URL scheme, the button starts that process. Download source for creating iOS App to call Custom URL Scheme.

 

urlScheme4b