Universal link do not work on real devices - ios

I'm currently working on implementing universals links into my App, they work perfectly on my simulators whether using command line xcrun simctl openurl booted or by tapping on links from messages
BUT I cannot run them on real devices (3 differents iPhones tested with 3 differents iOS 14.X versions)
App configuration > Signing and Capabilities > Associated Domains are correctly setup as applinks:<domain_name>.
I've already tried to :
uninstall/reinstall the App
clean my build repository
reboot my device
wait 5 minutes after installing the App
use another HTTP protocol for the route https://<domain>/.well-known/apple-app-site-association
tap the link from many apps (messages, discord, notes...)
expose my site with ngrok / localtunnel / apache server (in prod)
turn on/off "Associated Domains development" in Developer settings
I've verified on AASA validators sites like branch.io or appsflyer.com and everything is OK, once I reinstall the App to my iPhone, the aasa file is requested and it returns a 200 OK http response with the correct Content-Type : application/json
I ran out of idea to solve this issue. I really want to make it works before deploying the app on the Appstore even if it is working fine on simulators.
Thanks for your future help

Unfortunately, Universal links are not reliable for everyone, this seems to be an issue where the AASA files are not getting downloaded in the device.
Known Bug
There is a known universal bug for Apple where devices for iOS version 11.x+ , the AASA files do not get fetched and thus causing the Universal Links to fail.
Validate the issue
Normally, the Apple OS looks into retrying to fetch the AASA file at some time interval but the workaround might help for a test condition.
Inside the app, check if the AASA files were downloaded successfully or not. To do this:
Copy the link into your notes app.
Long-press the link till a dropdown appears. If the dropdown shows 'Open link', then Universal Links are not working for that device. If the link shows 'Open in app name', the configuration is working fine.
Backup plan
Also you can implement a fall back deeplink call on your sercerside with the help of user-agent and other stuff

In your apple-app-site-association file check if you are using "appID":".bundleid". If so, try replacing it with "appID":".bundleid" or vice-versa.

Related

React native Branch io deep linking in IOS not working

I have followed the set up doc of branch for react native io i.e. https://help.branch.io/developers-hub/docs/react-native
React native Branch io deep linking is working fine for Android part and For ios part if click the banner from my website it is taking me to appstore and not the app though app is installed in device.
When copy the link getting created when user clicking on the banner and pasting it in notepad and on long press I am getting "open in your app" option and its navigating to app.
Since the 'Open in your app' option is visible on long-pressing the link on Notes app, it means that the universal links are setup fine here.
As per your query in regards to the link being redirected to the AppStore even when the app is installed, occurs when the AASA files are not being fetched by the device. This is a common issue occurring in iOS (https://forums.developer.apple.com/thread/123554) as in when the device fails to fetch the AASA files but this is an intermittent one and can be fixed manually. Your device will also try to fetch the AASA files at certain durations so that might also solve the issue at times.
As for the manual process, would request you to check on the Branch documentation here and follow the necessary steps : https://help.branch.io/developers-hub/docs/ios-troubleshooting#section-validate-if-aasa-file-successfully-downloaded
If the console shows as the AASA files are not getting fetched, please try uninstalling the app, restarting the device, and reinstalling the app. Recreate the method of testing for AASA once more.
PLEASE NOTE : These steps are advisable only if the SDK is integrated fine as per our docs.

Universal Links work in simulator but not on real devices

I added the apple-app-site-association: <domain>/.well-known/apple-app-site-association
I started with the "applinks" and when that didn't work I also added webcredentials and activitycontinuation.
I enabled Associated Domains for this app id and in the project I added applinks:<domain>, applinks:m.<domain> & applinks:*.<domain> in the associated domains which now appear in the entitlements file.
I checked the domain in the apple validation tool https://search.developer.apple.com/appsearch-validation-tool/ and that worked.
I tested it on multiple simulators and in each of them I could go to the website in safari and it showed me the banner above, I also sent a fake message in the Messages and that showed the details and opened the app.
I also tried changing Deployment Target to iOS 10.
But when I try to install it on the device from xCode, either in debug or release configuration or even upload the build to test flight, this doesn't work (Tried on iPhone 5s, iPhone 8 & iPhone XR).
I searched the internet and saw many people saying that universal links did not work for them until they did this and that and I tried every thing they said but I still can't make it work on real devices.
Is there something else I should do to make this work or did I get something wrong?
You have to wait a bit ( from minutes to hours ) after your app is successfully installed and launched to let iOS fetch the associated domain.
You can use a proxy like Charles to check if iOS has make the call.
Got the same issue and fixed by replacing App ID prefix instead of team ID in apple-app-site-association file

How debug Universal links

I use the cordova plugin "ionic-plugin-deeplinks" (to my knowledge also works with a plain cordova app).
On Android, links when clicked let users choice between chrome and my application.
=> I suppose that app links works
=> As I'm able to access window.IonicDeeplink and redirect the user to the right page
I'm not able to have the same behavior on iOS, when I click a link I always get the app open in Safari.
How can I find clue on issues ?
More context:
apple-app-site-association is got with a HTTP 200 (over https only), it's located in /.well-known/apple-app-site-association:
I checked TeamID and BundleID 5 times (at least);
with the branch.io validator i get all validations green:
Your domain is valid (valid DNS).
Your file is served over HTTPS.
Your server does not return error status codes greater than 400.
Your file's 'content-type' header was found :)
Your JSON is validated.
with the apple validator, I got : "Action required
Could not extract required information for Universal Links. Learn how to implement the recommended Universal Links.
Error no apps with domain entitlements
The entitlement data used to verify deep link dual authentication is from the current released version of your app. This data may take 48 hours to update." (but some devs said that working app add the same error) what to do with that result?
when monitoring server's log while installing the app with Xcode I see a request get a HTTP 200 on apple-app-site-association
while installing the app with Xcode I got no logs referring to swcd in Xcode (I read here that I should if I had error while installing the app). Is a successful installation silent?
I followed that guide to setup entitlements, but some things feel odd with it:
Unlike the snapshot in the guide, I didn't found any *.entitlements file in my project. Should I have one with cordova? (my xCode seems to remember my setting though). Is it possible to check that installed app get entitlements?
I did set my domain in Xcode like this: applinks:mydomain.com and the switch is ON. But I never uploaded any thing from my local dev environment to apple services. Should I have? If yes, how ?
My current interrogations are highlighted but any explanations on any lack of understanding will be more than welcome!!!
Until then I started a verification for testFlight looking for more info.
while installing the app with Xcode I got no logs referring to swcd in xCode
I implemented Universal Links manually, but situation was similar. Particularly I mentioned empty swcd process log while installing the app, and it turned out that most likely iOS didn't even try to download apple-app-site-association file, like if responsible process wasn't run. In my case device restart helped and deep-linking began to work.
Thus I think restarting device is one another step in troubleshooting when you are sure about all your setup.
For anyone trying to debug this in development:
In XCode, ensure you're editing the Debug version of Signing & Capabilities.
To bypass the Apple Universal Links CDN, configure your Debug domains like applinks:?mode=developer -- adding that query string in development is important.
On your iOS Device, go to Settings->Developer->Universal Links and ensure the Associated Domains Development toggle is switched on.
On your iOS Device in Settings->Developer->Universal Links->Diagnostics, enter your Universal Links URL and ensure you get a green checkmark.
After following all of these steps, Universal Links work locally.

Universal Link broken in iOS 11.2

I am using Branch deep links in an app for sharing links to content in the app via social media. Everything was working fine quite a while.
When updating to iOS 11.2 I encountered the following behavior:
1) After the update the Universal Links still worked.
2) I uninstalled the app and reinstalled it.
3) Since then, all links always open the Branch deep view in Safari.
4) Tapping "Open The App", opens the AppStore.
It does not matter in which app I tap on the link (Notes, WhatsApp, Messages, Facebook, ...), it is always the same behavior.
The Universal Link was not bypassed by tapping the "go to link" button in the upper right corner (when app was opened). I tested on three different devices (iPhone 5s, iPhone 6s, iPhone 7). All led to the same result.
I found out that there was a bug in iOS 11 beta 2 which was fixed in the beta 3 (Ios 11.2 beta universal links open my app and safari), but it might have reappeared?!
Anyone having the same issues or a way to fix it?
Sometimes universal links don't work on iOS 11.2 for newly installed apps.
The symptoms are that clicking on a universal link won't open an app that is newly installed on a phone. The universal link takes the user to a web page and is prompted to download the app again.
Through testing here at Branch HQ we've discovered that the Apple App Site Associated Domains file (apple-app-site-association file) isn't always downloaded after the app is installed, either when it's installed from the app store or from Xcode.
Removing the app, restarting the phone, re-installing the app, and waiting a minute or so seems to clear this up. This is a horrible user experience obviously.
We have filed a radar with Apple and will continue to track this issue.
Mitigations
Set $uri_redirect_mode
Setting the $uri_redirect_mode option on links can have Branch try to force the link to open the app, even if it might show an error to the user. You can read about this option here, in the Branch docs.
Here's more info about turning on $uri_redirect_mode in your Branch Journey or Deepview banner, the web snippet that Branch shows the user if the ends up deep linking into a web browser:
Advanced Journey Configuration
Deferred Deep Linking Mitigates This Problem
This issue is mitigated by Branch's deferred deep linking tech: If the user opens the app from their home screen after the universal link is clicked, deferred deep linking still works, and the link content is shown in the app.
As an addition to #clayjones94's Answer, I have been unable to get my iPad 2nd gen (iOS 12.1.1) to recover the ability to use Universal links after switching between release and debug targets.
Yesterday it suddenly started to work, but then after changing build-target, the universal link has again broken.
I've uninstalled, rebooted, installed, rebooted and so on.
I was, however able to test the functionality in a simulator, so for now, I would recommend attempting a fresh simulator to make sure your AASA file is correct on the server.
EDIT: if you have a proxy involved, that may also break the validation between the app and the website

Get info for service 'applinks', app ID '<<NULL>>'

Trying to implement universal links in my iOS app running iOS 10, whenever a click a link in my webpage I get the following message in the device log:
Feb 24 15:07:11 iPhone swcd(CoreUtils)[10142] <Notice>: Get info for service 'applinks', app ID '<<NULL>>', domain 'www.redacted...'
My app is setup with the required entitlements and capabilities for this domain. My associated domains entitlements key contains these domains:
applinks:redacted.com
applinks:www.redacted.com
The server is hosting the apple-app-site-association file on the root folder over https. I made sure the content-type of the file is set to application/json and there are no redirects leading to it. The contents of this file are:
{
"applinks": {
"apps": [],
"details": [
{
"appID": "teamid.redacted-app-id",
"paths": ["*"]
}
]
}
}
The way I'm testing this is by going into my site and tapping the first link I find, every time I tap this link I get the message I pasted above and the link opens in safari.
Your description of the problem does not provide any smoking gun indicator of what the issue might be. As I indicated in my previous comment, to really work through Universal Linking issues it is best to know everything that was configured and have a proper test plan that allows the configuration and the testing to be reproduced. There are just too many areas that could be causing problems.
Generally, issues with Universal Linking fall into being either setup issues or testing issues:
Setup Issues
Is the AASA file properly named and properly signed, is it being served from the correct location, are all entitlements correct?
Are the device and provisioning certificates all error-free?
Are you testing with a link that the app has been properly configured to support?
Testing Issues
Are you testing with a physical device? (some say Universal Links now work consistently in the simulator with iOS 10, but I'd still use a physical device)
What links are you testing? You indicate that you are "going into my site and tapping the first link I find." Are these links you are finding in the "redacted.com" domain? I would not use "www.redacted.com" as "www" gets special treatment by many systems and may not work as anticipated.
Could the AASA file have failed to update when the app was first installed/launched due to an issue with the testing environment's network connectivity? I find that the AASA will fail to download if Charles Proxy is capturing traffic, for example. If the AASA file does not make it to the device, Universal Linking will not work.
When testing, it sounds like you are not first pasting the link into Notes and then long-pressing on it. I would strongly recommend that you always test in this fashion first, so as to rule out the issue being related to your website, the application from which you are tapping the link, or the manner in which you are deploying the link (Universal Links will not behave as expected if you paste them into the Safari address bar, for example). When you do test by long-pressing on a link in Notes you should see "Open in App" menu option. If you do see this, but tapping on the link does not open the app, this would indicate that Universal Linking has been disabled on the device.
What is the behavior you are expecting to see when you tap on these links, and what is the actual behavior you are seeing? I often encounter people who believe Universal Linking is broken because they are testing a scenario that Universal Linking does not support. Are you sure the behavior that you are testing for is supported?
Are you using a device and an iOS version that supports Universal Links? Testing should be performed on physical devices, as mentioned earlier, and on iOS versions after 9.0 (where Universal Linking was introduced).
When Universal Linking does not work, there are a lot of things to check. I recommend running through Alex Austen's super blog post on this topic, as doing so may help you spot the problem (here: https://blog.branch.io/how-to-setup-universal-links-to-deep-link-on-apple-ios-9/).
Branch also has a number of tools/resources for identifying Universal Linking issues. They are specifically intended for use with Branch links, but you may still find them helpful:
AASA Validator: https://branch.io/resources/aasa-validator/
Universal Link Validator: https://dev.branch.io/getting-started/universal-linking-validator/guide/
Universal Linking Troubleshooting Guide: https://support.branch.io/support/solutions/articles/6000153326-ios-universal-links-troubleshooting-guide
Look at the logs here is how (taken from SO):
Xcode –> Windows –> Devices & Simulators
Click on device in the left
pane Click Open Console
From there, filter on "swcd" (SharedWebCredential Daemon). Keeping this console open.
You might need to open the console before installing your app dunno if it saves history while closed.
My problem:
I had my apple-app-site-association file hosted on subdomain.mydomain.com but then in Xcode I had Associated Domains set to applinks:*.mydomain.com. In the console mentioned above I saw that in this case the app was trying to get its apple-app-site-association file from mydomain.com. So I changed the Associated Domains to applinks:subdomain.mydomain.com
If none of the above workarounds work for you, please check if you have added activitycontinuation in associated domains or not.
Below is the picture showing the exact place where you have to add that.
(of course you haven't done that already).

Resources