IOS 9 Universal links (Universal links)

Source: Internet
Author: User

What is universal Links?

Before iOS9, we usually only use scheme for the need to wake up apps from a variety of browsers and Safari. However, this method needs to be judged in advance whether an app that responds to this scheme is installed in the system and is disabled in this way.

Universal Links is a feature of iOS9 that allows your app to launch the app via a traditional HTTP link (if your app is already installed on your iOS device, no matter where you are or where it is), or open a webpage (your app isn't installed on your iOS device).

Below is a brief description of how to use universal Links, specific to the official documentation

How to use universal Links

1. Prerequisites: You must have a domain name, and this domain name needs to support HTTPS.

2. Need to configure in the developer Center: find the corresponding app ID, in the application services list there is a associated domains, it can be enabled.

Configure the app ID to support associated Domains:



3. Open the associated Domains in the project configuration, fill in the Domains in which you want to support the domain name, must be prefixed with the applinks:. Associated Domains:4 in the configuration item. To create a file in JSON format, Apple will request this file from the domain name we filled out in the project at the appropriate time. This file name must be apple-app-site-association, there is no suffix, the file content is probably like this:
{"    applinks": {        "apps": [],        "Details": [            {                "AppID": "9JA89QQLNQ.COM.APPLE.WWDC",                "Paths": [ "/wwdc/news/", "/videos/wwdc/2015/*"]            },            {                "AppID": "ABCD1234.COM.APPLE.WWDC",                "Paths": ["*"]            }        ]    }}

Description

AppID: The composition is Teamid.yourapp ' s bundle identifier. As above the 9JA89QQLNQ is Teamid. Login to the Developer center and find the team ID in account- membership. Paths: Set the list of paths supported by your app, only the links of these specified paths can be processed by the app. The asterisk notation represents all the links under the recognizable domain name. 

There are many examples of other companies in this blog that can be consulted. There may also be companies that are no longer applicable and can be swapped for other companies.

5. Upload the file to the root directory of your domain name or .well-knownDirectory, this is for Apple to get the files you upload. After uploading, you first visit to see if you can get to, when you enter this file link in the browser, should be directly download apple-app-site-association file.Validation

Enter a link that the app can identify in the memo on your iOS device, and then click the link directly to jump to your app. Or a long press, the second item in the pop-up menu that appears is that 在’XXX’中打开 it also represents success:

Or the URL you're about to test opens in Safari and falls above the page that appears, you can see 在”XX”应用中打开: The menu appears:

In the Web browser is also possible, although blocking all the scheme way to jump to other apps, but universal links is directly processed by the system, shielding can not, this also realized from jump to our app.

For the convenience of developers, Apple has provided a Web page to verify that the apple-app-site-association we have written is valid and validated by entering the verification URL:


processing after entering the app

Now the user clicks on a link, directly can enter our app, but our goal is to be able to obtain the user to come in the link, according to the link to show the user corresponding content.
We need to implement the method in the appdelegate of the project.

-(BOOL) Application: (UIApplication *) application continueuseractivity: (nsuseractivity *) useractivity Restorationhandler: (void (^) (Nsarray * _nullable)) restorationhandler{    if ([Useractivity.activitytype Isequaltostring:nsuseractivitytypebrowsingweb])    {        Nsurl *url = Useractivity.webpageurl;        If (URL is what we want to process)        {            //do our processing        }        else        {            [[uiapplication sharedapplication] openurl:url];        }    }        return YES;}
Attention

Front-end development often faces cross-domain issues and must require cross-domain, if not cross-domain, not.
Universal Link only takes effect if the URL domain name of the current webview is inconsistent with the destination URL.

All right, first of all, if you have any questions, you can read the official documentation in detail.

Turn from (HTTPS://WWW.JIANSHU.COM/P/734C3EFF8FE)

IOS 9 Universal links (Universal links)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.