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.
Related
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/*",
"/*"
]
}]
}
}
I have an application which supports universal links and it is currently in the app store.
Say it supports the domain www.example.com and thus universal links can be easily opened via this. We will have applinks:www.example.com in associated domains.
Now say if I want to release another app and it also supports the same domain. Now how will iOS distinguish which app to open via universal links..?
In order to supporting Universal Links with single domain on two different apps you need to make changes in your existing apple-app-site-association file, at https://{domain}/apple-app-site-association.
For Single App Support
For single application support it's look like this
{
"applinks": {
"apps": [],
"details": [
{
"appID": "1234ABCDE.com.domain.myapp",
"paths": ["*"]
}
]
}
}
For Multiple App Support
For multiple application support, you need add one more key-value pair in details array of applinks in apple-app-site-association. It's look like this
{
"applinks": {
"apps": [],
"details": [
{
"appID": "1234ABCDE.com.domain.myApp",
"paths": ["*"]
},
{
"appID": "1234ABCDE.com.domain.mySecondApp",
"paths": ["*"]
},
{
"appID": "1234ABCDE.com.domain.myThirdApp",
"paths": ["*"]
}
]
}
}
General Format of apple-app-site-association file
The file looks like this:
{
"applinks": {
"apps": [ ],
"details": [
{
"appID": "{app_prefix}.{app_identifier}",
"paths": [ "/path/to/content", "/path/to/other/*", "NOT /path/to/exclude" ]
},
{
"appID": "TeamID.BundleID2",
"paths": [ "*" ]
}
]
}
}
References
How to support Universal Links in iOS App and setup server for it?
I found the solution, its pretty simple though.
My problem was that my first app was supporting all the pages by stating
"*" in the paths section of apple-app-site-association file. Now all I have to do is add NOT in front of one of the paths which I wanted my second app to handle.
like "NOT /cabs". I haven't tested it yet if this works or not. I will post an update as soon as I am done with it.
Apple App Site Association file example
{
"applinks": {
"apps": [],
"details": [{
"appID": "D3KQX62K1A.com.example.photoapp",
"paths": ["/albums"]
},
{
"appID": "D3KQX62K1A.com.example.videoapp",
"paths": ["/videos"]
}]
}
}
Important: The order of the dictionaries in the array determines the order the system follows when looking for a match. The first match wins, allowing you to designate one app to handle specified paths within your website, and another app to handle the rest.
References:
https://developer.apple.com/documentation/uikit/core_app/allowing_apps_and_websites_to_link_to_your_content/enabling_universal_links
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"