Introduce a,

Universal Link is one of the new iOS 9 features apple announced at WWDC 2015. This feature is similar to deep linking and makes it easy to start the client directly by opening an HTTPS link. This new feature provides an excellent user experience when implementing a seamless web-app connection compared to the URL Scheme used in the past.

It is an improvement over URL Scheme in that it is more flexible and web-friendly.

Ii. Preparation for integration

  • Domain name (must be HTTPS)
  • Apple – the app – site – association file
  • IOS 9 or above (now available for most apps)

Three, steps,

Open on developer.apple.comAssociated Domainsservice

2. Open it in AppAssociated Domainsservice

The domain name format is applinks:www.example.com

3, configuration,apple-app-site-associationfile

The official document is as follows

{
    "applinks": {
        "apps": []."details": [{"appID": "9JA89QQLNQ.com.apple.wwdc"."paths": [ "/wwdc/news/"."/videos/wwdc/2015/*"] {},"appID": "ABCD1234.com.apple.wwdc"."paths": [ "*"}]}}Copy the code
  • Apps must correspond to an empty array;
  • Details corresponds to an array of dictionaries;
  • The composition of appID is teamID. BundleID.
  • AppID + Paths can correspond to multiple apps in one file (detailed configuration will be explained later).
  • Files cannot have suffixes
  • The file is stored in the root directory of the domain name or /. Well-known/on the server
Add the following code to the Appdelegate
- (BOOL)application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity restorationHandler:(void (^)(NSArray<id<UIUserActivityRestoring>> * _Nullable))restorationHandler {
    return [WXApi handleOpenUniversalLink:userActivity delegate:self];
}
Copy the code

The code here is shared by WX, and the specific logic needs to be written by yourselves.

Here, whether it is the friendship alliance or their own sharing, basically can be used.

4. Multiple apps of the same company use the same domain name

{
    "applinks": {
        "apps": []."details": [{"appID": "9JA89QQLNQ.com.apple.wwdc"."paths": [ "/wwdc/*"] {},"appID": "9JA89QQLNQ.com.apple.appstore"."paths": [ "/appstore/*"}]}}Copy the code

Multiple apps for a domain name can be distinguished by path, and then fill in the corresponding URL during registration