Universal Links (apple-app-site-association文件说明)

一、示例:
{
  "applinks": {
      "substitutionVariables": {
          "food": [ "burrito", "pizza", "sushi", "samosa" ]
       },
      "details": [
           {
             "appIDs": [ "ABCDE12345.com.example.app", "ABCDE12345.com.example.app2" ],
             "components": [
               { 
                  "/" : "/$(lang)_$(region)/$(food)/"
               },
               {
                  "#": "no_universal_links",
                  "exclude": true,
                  "comment": "Matches any URL whose fragment equals no_universal_links and instructs the system not to open it as a universal link"
               },
               {
                  "/": "/buy/*",
                  "comment": "Matches any URL whose path starts with /buy/"
               },
               {
                  "/": "/buy/*",
                  "#": "my_great_product_123",
                  "comment": "Matches any URL whose path starts with /buy/ and fragment equals my_great_product_123, ignoring case"
               },
               {
                  "/": "/help/website/*",
                  "exclude": true,
                  "comment": "Matches any URL whose path starts with /help/website/ and instructs the system not to open it as a universal link"
               },
               {
                  "/": "/help/*",
                  "?": { "articleNumber": "????" },
                  "comment": "Matches any URL whose path starts with /help/ and which has a query item with name 'articleNumber' and a value of exactly 4 characters"
               }
             ],
             "defaults": { "caseSensitive": false, "percentEncoded": true }
           }
       ]
   },
   "webcredentials": {
      "apps": [ "ABCDE12345.com.example.app" ]
   },
    "appclips": {
        "apps": ["ABCED12345.com.example.MyApp.Clip"]
    }
}
二、各字段说明:

Services

Services include:

  • webcredentials
    Use this service for shared web credentials.
  • applinks
    Use this service for universal links.
  • activitycontinuation
    Use this service for Handoff.
  • appclips
    Use this service for an App Clip.

applinks

  • defaults iOS 14.0+
    The global pattern-matching settings to use as defaults for all universal links in the domain.
  • details iOS 9.0+
    An array of Details objects that define the apps and the universal links they handle for the domain.
  • substitutionVariables iOS 13.5+
    Custom variables to use for simplifying complex pattern matches. Each name acts as a variable that the system replaces with each string in the associated string array.

applinks.Defaults

  • caseSensitive boolean
    A Boolean value that indicates whether pattern matching is case-sensitive. The default is true.
  • percentEncoded boolean
    A Boolean value that indicates whether URLs are percent-encoded. The default is true.

applinks.Details

  • appIDs [string]
    An array of application identifiers that specify the apps that can handle the universal links in the components array.
  • components applinks.Details.Components
    An array of components that define the universal link URLs an app can handle.
  • defaults applinks.Defaults
    A dictionary for defining the default settings to use for all universal links pattern matching in the components array.

applinks.AppIDs

Use appIDs to specify the apps that can access the specific URLs you define in the associated components array. You specify the application identifiers in the following format:
.

applinks.Details.Components

  • / string
    The pattern to match with the URL path component. The default is *, which matches everything.
  • ? * string, applinks.Details.Components.Query
    The pattern or dictionary to match with the URL query component. The default is *, which matches everything.
  • # string
    The pattern to match with the URL fragment component. The default is *, which matches everything.
  • exclude boolean
    A Boolean value that indicates whether to stop pattern matching and prevent the universal link from opening if the URL matches the associated pattern. The default is false.
  • comment string
    Text that the system ignores. Use this to provide information about the URLs a pattern matches.
  • caseSensitive boolean
    A Boolean value that indicates whether pattern matching is case-sensitive. The default is true.
  • percentEncoded boolean
    A Boolean value that indicates whether URLs are percent-encoded. The default is true.

applinks.Details.Components.Query

  • Any Key string
    The pattern to match with the specified NSURLQueryItem name.

applinks.SubstitutionVariables

  • Any Key [string]
    An array of strings to substitute for the associated variable in URL pattern-matching operations.

参考:
Support Universal Links
Supporting Associated Domains
Associated Domains Entitlement
applinks

你可能感兴趣的:(Universal Links (apple-app-site-association文件说明))