I implemented Universal Links. The apple-app-site-association is structured as follows:
{
"applinks": {
"apps": [],
"details": [
{
"appID": "APPID.my.awesome.newspaper",
"paths": [ "NOT /webapp/issue/*/ads/*", "/webapp/issue/*/*.html" ]
}
]
}
}
For some reason the first path with the NOT is not considered at all.
For example:
These URL's are handled as expected:
awesome-newspaper.my/webapp/issue/sz/2016-01-22/page_2.157908/article_1.2828646/article.html
awesome-newspaper.my/webapp/issue/sz/2016-01-22/page_2.157908/page.html
This URL should not be handled as Universal Link and should always open in Safari.
awesome-newspaper.my/webapp/issue/sz/2016-01-22/ads/ad_145/index.html
But it always opens in the App as well.
Can someone please help me out?
i think the problem is that your URL matches both cases, which is then making the results unpredictable.
try making the paths mutually exclusive. if thats not possible you may need to change the URL structure.
UPDATE:
it's possible that your NOT string is ill formatted, try changing it to: "NOT /webapp/issue/*/ads/*/*.html"
Related
We've implemented Universal Links as described here so that users can confirm their account. We recently introduced some some new controllers/pages to our site and we found that all links will open the app regardless of what is in the apple-app-site-association file. I've checked our configurations and can't find an issue.
Before new pages added:
{
"applinks": {
"apps": [],
"details": [
{
"appID": "XXXXXXXX.com.mybundle.identifier",
"paths": ["*"]
}
]
}
}
After new pages added:
{
"applinks": {
"apps": [],
"details": [
{
"appID": "XXXXXXXX.com.mybundle.identifier",
"paths": ["NOT /about/*", "NOT /home/*", "*"]
}
]
}
}
Things to note:
I've tried several variations in the paths including "NOT /about*" or "NOT *" and all links will still open the app.
AASA Validator returns all green.
I've versioned and uninstalled between each test.
Any thoughts on what we could check next?
In the last section of document about allowing_apps_and_websites_to_link_to_your_content, it says:
Use wildcards in path strings within the paths array to specify
sections of your website. For example, append * to a specific URL,
such as /videos/samples/2015/, to specify all paths below
/videos/samples/2015/. Use ? to match any single character, such as
/photography//samples/201?/mypage. Use a standalone * to specify your
entire website.
And
Identify an area that should not be handled by adding “NOT ”
(including a space after the T) to the beginning of the path string.
So, in you second paths, you use NOT and * at the same time which is contradictory. I think you should change it to:
"paths": ["NOT /about/*", "NOT /home/*"]
Or something like
"paths": ["NOT /about/*", "NOT /home/*", "/vailddomain/*"]
I have not test it but I think it's probably the right solution.
How do you set up my apple-app-site-association file to open my app on my homepages root page without using the * wildcard (which, according to apple, is used 'to specify your entire website').
{
"appID": "9JA89QQLNQ.com.apple.wwdc",
"paths": ["/some/sub/page/*", "*"]
}
As far as I understand, this would be redundant and hereby I would specify my entire website to be opened in the app, which is something I do not want.
So maybe I need to do something like this:
{
"appID": "9JA89QQLNQ.com.apple.wwdc",
"paths": ["/some/sub/page/*", "/"]
}
Or negate the subpages?
{
"appID": "9JA89QQLNQ.com.apple.wwdc",
"paths": ["/some/sub/page/*", "*", "NOT */"]
}
Would be great if I could get some thoughts on this!
I've done some research on this, but cannot seem to figure this out.
Additional question: What do I do if I have a questionmark in one of the links I want to use (because that can be used as a wildcard as well)?
The path for the root page is / — your second example is correct.
A question mark in q URL indicates the beginning of the query component of the URL — you can't filter Universal Link paths based on this component.
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?
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"]
}
]
}
}
Identify an area that should not be handled by adding “NOT ” (including a space after the T) to the beginning of the path string. For example, you Want to prevent to handle the /videos/samples/2010/* area of the website then the paths array as shown here:
"paths": [ "/videos/collections/*", "NOT /videos/samples/2010/*", "/videos/samples/201?/*"]
Here is my actual apple-app-site-association file:
{
"applinks": {
"apps": [],
"details": [ {
"appID": "XXXXXXXXX.com.example.app",
"paths": [
"NOT /Registration",
"/*"
]
}]
}
}
I would like to allow every urlendpoint to working as universal link, expect the example.com/Registration/whatever
But the above code not working. If I click on a registration link, it open my application.
I tried a lot of version of this file eg: "NOT /Registration/*", "NOT /Registration*", "NOT /Registration/", but no one work.
What is wrong?
UPDATE:
Here is my full example registration link:
https://example.com/Registration/AccountActivation?activationCode=XXXX
I do not have a fix for your problem, but I can give you a possible explanation. I'm leaving this here for reference in the hopes that I overlooked something.
Did you try reinstalling the app after changing the file? I had a simmilar problem not long ago. It seems that apple is only fetching the file once on install. From the orininal source:
During my troubleshooting, I discovered it’s best to verify an app is
making the HTTPS request for the apple-app-site-association file. It’s
important to know that apps only attempt to this once per
installation. The request occurs the first time an app is launched
after installation. Furthermore, force closing an app and then
launching it will NOT trigger the app to reload
apple-app-site-association.
via https://medium.com/#barsh/my-first-date-with-ios-universal-links-90dfabc88bb8#.wyrslx2di
As I said, there seems to be no solution on updating the file without a reinstall of the app.
NOT /Registration is a match for yourdomain.com/Registration but not any subpath e.g. /Registration/AccountActivation....
I believe this should achieve what you're looking for:
{
"applinks": {
"apps": [],
"details": [ {
"appID": "XXXXXXXXX.com.example.app",
"paths": [
"NOT /Registration/*",
"/*"
]
}]
}
}
There are several other posts which say universal links are not working. I have a different issue where these links are working, however I want to exclude some specific url's on my website from launching the app and this is not working.
As documented here:
https://developer.apple.com/library/archive/documentation/General/Conceptual/AppSearch/UniversalLinks.html
I have implemented the necessary steps for universal link including uploading the apple-app-site-association file.
The file looks like this example:
{
"applinks": {
"apps": [],
"details": [
{
"appID": "AB1CDEFGHI.com.mydomain.myapp",
"paths": [ "*", "NOT /help/" ]
}
]
}
}
The intention here is if a user clicks www.mydomain.com/help it will not launch the app but open this page in safari. However this link opens the app.
I have tried several versions of this path including:
/help/*
/help/
/help
help
none of these provide the desired exclusion functionality.
Has anybody been able to implement this type of exclusion?
To answer my own question, by changing:
[ "*", "NOT /help/" ]
to:
[ "NOT /help/", "*" ]
It worked as expected. The order of the paths matters and by putting "*" first the system will find a match on the first path and will launch the app.
Simple enough...
You should use "NOT /help/" having the NOT inside the string.
Also, I suggest you look at AppsFlyer's solution for Universal Links. It may be a good alternative (using another applinks path).