Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS Universal Links: how to exclude certain paths from URL?

I´m using the new Universal Links feature of iOS, but want to disable certain paths of my homepage for the feature.

E.g.: All URLS that contain "_id_" and the starting page, but not http://example.com/testsite from the domain http://example.com should be opened within my app. How can I solve this?

My apple-app-site-association file on the server looks like this:

{
"activitycontinuation": {
    "apps": [
        "ABCDEFGHIJ.com.example.ios"
    ]
},
"applinks": {
    "apps": [],
    "details": [
        {
            "appID": "ABCDEFGHIJ.com.example.ios",
            "paths": [
                "/",
                "*_id_*"
            ]
        }
    ]
}
}

My entitlements file in the app:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"     "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>com.apple.developer.associated-domains</key>
    <array>
        <string>activitycontinuation:example.com</string>
        <string>activitycontinuation:www.example.com</string>
        <string>activitycontinuation:m.example.com</string>
        <string>applinks:example.com</string>
        <string>applinks:www.example.com</string>
        <string>applinks:m.example.com</string>
    </array>
</dict>
</plist>

I didn´t find any option to exclude certain paths. How is this feasible?

like image 339
stk Avatar asked Oct 01 '15 09:10

stk


1 Answers

Prepending a path with NOT to excludes that path from being matched. Example -

{
"applinks": {
    "apps": [ ],
    "details": [
        {
            "appID": "{app_prefix}.{app_identifier}",
            "paths": [ "NOT /path/to/exclude"]
        }
    ]
}
}

There are 3 ways to define paths:

Static: The entire supported path is hardcoded to identify a specific link, e.g. /static/terms
Wildcards: A * can be used to match dynamic paths, e.g. /books/* can matches the path to any author’s page. ? inside specific path components, e.g. books/1? can be used to match any books whose ID starts with 1.
Exclusions: Prepending a path with NOT excludes that path from being matched.

The order in which the paths are mentioned in the array is important. Earlier indices have higher priority. Once a path matches, the evaluation stops, and other paths ignored. Each path is case-sensitive.


Reference

How to support Universal Links in iOS App and setup server for it?

like image 92
Vineet Choudhary Avatar answered Oct 26 '22 03:10

Vineet Choudhary