1

I have implemented universal links and working fine but now I need to exclude few url types from opening app so i tried following ways with apple-app-site-association file.

{
    "applinks": {
        "apps": [],
        "details": [{
            "appID": "abc",
            "paths": ["NOT /test_url_1/", "NOT /test_url_2/"]
        }]
    }
}

"paths":["NOT /test_url_1/", "NOT /test_url_2/"] - will ignore ALL urls, no redirection to the mobile app

{
    "applinks": {
        "apps": [],
        "details": [{
            "appID": "abc",
            "paths": ["NOT /test_url_1/", "/test_url_2/"]
        }]
    }
}

"paths":["NOT /test_url_1/", "/test_url_2/"] - will ignore /test_url_1/ url, allow /test_url_2/ and ignore other urls

{
    "applinks": {
        "apps": [],
        "details": [{
            "appID": "abc",
            "paths": ["NOT /test_url_1/", "NOT /test_url_2/", "*"]
        }]
    }
}

"paths":["NOT /test_url_1/", "NOT /test_url_2/", "*"] - will open ALL urls in the mobile app

I just need to ignore test_url_1and test_url_2 and open mobile app for other urls. Is there anyway to do this? am I missing something here?

Cœur
  • 37,241
  • 25
  • 195
  • 267
cham
  • 127
  • 9
  • why it is down voted, really cannot understand the reason – cham Apr 07 '17 at 11:49
  • 1
    Some StackOverflow citizens get a bit bent out of shape over small things, especially by new users. In this case, I suspect it was a combination of the question topic (which is fairly straight-forward to answer via some Google sleuthing) and the fact you didn't format the content to make it actually readable (fixed that for you ). Don't worry too much about it, but some things to keep in mind for the next question! – Alex Bauer Apr 07 '17 at 17:17

2 Answers2

1

Your third example should be correct, and matches both the specifications and examples I've seen in working practice before. We'd probably need to see non-anonymized data and actual links to debug any further.

You could possibly also try this:

{
    "applinks": {
        "apps": [],
        "details": [{
            "appID": "abc",
            "paths": ["NOT /test_url_1/*", "NOT /test_url_2/*", "*", "/"]
        }]
    }
}
Alex Bauer
  • 13,147
  • 1
  • 27
  • 44
0

You have to check it by casting each of your url to string and look for the ur that you don't want to be in your new url path like so

let url = URL(string: "/test_url_1/somepoints/")!
let urlString = url.absoluteString
var newURL:URL!

if !urlString.contains("test_url") {
   newURL = URL(string: urlString)
  // use the new url now
}

for a big list of urls you have to make this test inside a for loop and generate the urls that you want

Khalid Afridi
  • 913
  • 5
  • 12
  • appreciate your fast reply, but I am refering with universal links and apple-app-site-association, I am not sure that we can do this, can we? – cham Apr 07 '17 at 11:10
  • 100% sure you can do that – Khalid Afridi Apr 07 '17 at 11:24
  • seems I am missing something, can you please explain me how universal links can be related with some coding inside of our app, if so what is the point of we having apple-app-site-association file in our web root, please help me to understand – cham Apr 07 '17 at 11:31