Search code examples
iosios9deep-linking

How to restrict all other paths except one for Universal link in iOS to open app using URL


I am using Unviversal link in iOS application. I am referring Apple doc: https://developer.apple.com/library/content/documentation/General/Conceptual/AppSearch/UniversalLinks.html

I want to open app for only one path. example domain is https://example.com and paths are /a, /b, and so on. I want to give access to only '/b' path. How do I do it?


Solution

  • Universal Links operate on an opt-in basis for URLs. In other words, if you don't explicitly specify a path in the apple-app-site-association file (either by literal string or wildcard matching), it won't be used.

    Using Apple's example as a basis:

    {
        "applinks": {
            "apps": [],
            "details": [
                {
                    "appID": "9JA89QQLNQ.com.apple.wwdc",
                    "paths": [ "/b"]
                }
            ]
        }
    }