Universal link Implementation on iOS9 (tutorial)

Source: Internet
Author: User
Tags ssl certificate

1.Universal Link

Understand that Apple's official support for Deeplink is fine.

2. Launch the app by clicking on the HTTP link

Web?ios application in support of universal link, when users click on the characteristics of the link will start their own application

? App has been installed under the premise: directly launch the app and then the real link content

? The app is not installed: The link content continues to appear on the web

How to implement 3.Universal link

First you need to prepare the content

Web server

? Independent domain

? SSL Certificate

? The JSON file that was signed

iOS apps

? iOS9 or more

? Xcode 7?ios 9 SDK

? Capabilities

? Proxy settings for Appdelegate

Settings for 3.1 capabilities

In capabilities settings, set the Domains content of ' associated Domains '

Example: https://www.facebook.com/applinks:facebook.com

Note: There is no need to think about subdomain,www.

3.2 Configuration of apple-app-site-association files

Apple-app-site-association files must be placed in the root directory of the server!!!!!!

The first thing to do is to prepare the Apple-app-site-association file

{"  applinks": {"    apps": [],    "Details": {"      TBEJCS6FFP.com.domain.App": {        "Paths": ["*"]      }    }  }}

Paths content is the link path initiated by the corresponding app

Use "*" when using the full path.

Specific content needs to be specified at a particular location,

["/wwdc/news/",/videos/wwdc/2015/*]

TBEJCS6FFP.COM.DOMAIN.APP This part uses your teamid and bundle Identifier

3.3 Signing of the Apple-app-site-association file

I used the following method to sign the apple-app-site-association.

Cat Apple-app-site-association-unsigned.js | OpenSSL smime-sign-inkey g01-server.key-signer g01-server.crt-certfile g01-dvcacert.cer-noattr-nodetach-outform DE R > Apple-app-site-association

Development of the 3.4 app

Add the following code to the APPDELEGATE.M file

-(BOOL) Application: (UIApplication *) application continueuseractivity: (nsuseractivity *) useractivity Restorationhandler: (void (^) (Nsarray * _nullable)) restorationhandler{    NSLog (@ "continueuseractiity enter");    NSLog (@ "\taction Type:%@", useractivity.activitytype);    NSLog (@ "\turl         :%@", useractivity.webpageurl);    NSLog (@ "\tuserinfo:%@", useractivity.userinfo);        NSLog (@ "continueuseractiity exit");    Restorationhandler (nil);        Nshttpcookiestorage *sharedhttpcookiestorage = [Nshttpcookiestorage sharedhttpcookiestorage];    Nsarray *cookies = [Sharedhttpcookiestorage CookiesForURL:userActivity.webpageURL];     NSLog (@ "Cookie{name:%@", cookies);    return true;}

As the code shows, we can get some basic information about the jump link.

URL content, ActionType, etc. are all available and can be modified in the code.

4. Results

With the above configuration, a basic universal link application is completed for development

Click on the corresponding link we can see our app has been successfully launched

5. Some facts

Different directory structure of the same server may cause universal link not to start

When the app and JSON files are updated at the same time, the part of the JSON update may not be effective

If you need to use my server and app to test, you can also private messages me.

 

Universal link Implementation on iOS9 (tutorial)

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.