iOS Universal Links

Last Updated: Feb 07, 2017 04:07PM PST

Overview

The purpose of this article is to provide an overview to the iOS Universal Link technology.  If you're looking for how you configure Universal Links in Apsalar, please see our SmartTag and Destinations article.  If you're unfamiliar with Universal Links, we highly recommend reviewing this guide!

Universal Links is an Apple deep-linking technology introduced and available only to devices on iOS 9 and above.  It is a technology meant to replace the traditional URL scheme deep-linking, and to address the need for serve the best user experience to iOS app users regardless of if the app is present on the device.  A Universal Link resembles a normal HTTPS URL such as https://www.mycompanyname.com.  If the URL is configured as a Universal Link for your company app, clicking on the URL if the app is installed will take the user into the app.  If the user doesn't have the app installed, the user is taken to the URL in their mobile browser.
 

Configuring Universal Links



Enable Associated Domains in Apple Developer Account 

Navigate to your Apple developer account and to your specific app's ID page.  You will need to enable the Associated Domains application service as in the screenshot below.  Take note of your Prefix (bundle ID), and your ID (team ID).  These values are important for the next step.  



 

Create apple-app-site-association File

Using the Prefix and ID from your Apple developer console app page, you will need to configure a JSON formatted file.  This JSON file needs to be hosted on an HTTPS web domain accessible from the root.  For example, if you own the https://www.mycompanywebsite.com/ domain, your JSON file should be accessible at https://www.mycompanywebsite.com/apple-app-site-association .  Note that the hosted file does not contain a .json file extension.  

The apple-app-site-association file itself contains something similar to the following:
 

{
    "applinks": {
        "apps": [],
        "details": [
            {
                "appID": "3A32FBRP6C.com.apsalar.favoritewallpaper",
                "paths": [ "/page/all/", "/user/saved/*"]
            }
        ]
    }
}
The file contains any appID that is your [teamID].[app bundle ID] which identifies your app.  The paths details valid content pages in your app.  Apple recommends keeping paths short, and rely on wildcards to specify multiple values.  A generic [ "*" ] wildcard may be used to specify all paths.  The use of a NOT keyword may also be used to exclude path values, such ash ["NOT /user/saved/*"].  For more options, please refer to Apple's detailed documentation on specific restrictions on the format and hosting of the file in case you have an atypical set up.  




Add Associated Domain Capability to Your Application

Next, your application must be correctly configured to receive your above domain, as an Associated Domain.  Enable Associated Domains and add your domain to your application in Xcode, under Capabilities as below:


 



Handle Universal Links Code

Lastly, make sure that any Universal Link that opens your app is handled correctly.  To do so, implement the application:continueUserActivity:restorationHandler: method in your application delegate.  
 
- (BOOL)application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity restorationHandler:(void (^)(NSArray * _Nullable))restorationHandler{

   if ([userActivity.activityType isEqualToString: NSUserActivityTypeBrowsingWeb]) {
        NSURL *url = userActivity.webpageURL;

       // Put code here to take user to relevant content
   }
   return YES;
}

It's also recommended that your application supports traditional URL scheme-based deep-linking.
 

Can I use Universal Links in Apsalar?

Yes!  If your app already supported Universal Links as outlined above, you may use the Universal Links in Apsalar destinations.  If you choose, Apsalar can also host a Universal Link for your application which offers a different user experience to optimize for user engagement to your app.


 

support@apsalar.com
http://assets3.desk.com/
apsalarinc
Loading
seconds ago
a minute ago
minutes ago
an hour ago
hours ago
a day ago
days ago
about
Invalid characters found
/customer/en/portal/articles/autocomplete