Universal Links work in simulator but not on real devices - ios

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

Related

Universal link do not work on real devices

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.

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

iOS universal links not working?

I'm having trouble getting universal links to work
We have added the json content to our site https://couchsurfing.com/apple-app-site-association
I have double checked that it's using the correct team ID and bundle ID
Universal links is enabled in itunesConnect
running the apple validation fails with the following error:
Error no apps associated with url
I thought maybe the validator doesn't work, but running on iOS 10 device (universal link capability on, with added correct domain to it) clicking a valid link does not trigger the delegate methods in AppDelegate
Any thoughts?
After 3 weeks... It turned out my path was incorrect. My suggestion:
set paths to ["*", "/"] while debugging, get everything to work and test, then as the final step update the path and only include supported paths.
To be more specific the link I was trying to register was
site.com/events/123123 so I would add a path for /events which is wrong that would register site.com/events. I had to register /events/* instead
Also the easiest way to test it is to enter the expected links into the Notes app, because Safari has some weird logic on when links should be handled as deeplink.
Apple's app-site-association validator is useless, it's still failing for me complaining about my App id, when deeplinks actually work. Instead use https://limitless-sierra-4673.herokuapp.com/
I've recently had issues debugging the Universal Link functionality of my app.
I was able to get deep linking to work but it seemed to only work 10% of the time. Since I had just updated to iOS 12, I wanted to make sure there was nothing else I had to do as a developer to ensure the feature worked.
So what was causing intermittent failure?
It seems that iOS has a somewhat strict policy engine for determining when background threads can run.
I was able to observe this by USB tethering to my phone and opening up the debug console for my device
Xcode –> Windows –> Devices & Simulators
Click on device in the left pane
Click Open Console
From there, I was able to filter on "swcd" (SharedWebCredential Daemon). Keeping this console open, I was able to see the daemon at work during app install which is when iOS attempts to pull down the apple-app-site-association file for my app.
As it turns out, dasd (DuetActivitySchedulerDaemon) was failing to run the SharedWebCredential Daemon because my phone had restarted recently, then later it was determined that my phone was too hot...
e.g.
{name: ThunderingHerdPolicy, policyWeight: 1.000, response: {Decision: Must Not Proceed, Score: 0.00, Rationale: [{deviceInUse == 1 AND timeSinceThunderingHerdTriggerEvent < 900}]}}
], FinalDecision: Must Not Proceed}
{name: ThermalPolicy, policyWeight: 5.000, response: {Decision: Absolutely Must Not Proceed, Score: 0.00, Rationale: [{thermalLevel >= 20}]}}
], FinalDecision: Absolutely Must Not Proceed}
Developers beware!
I step through Apple's troubleshooting universal links procedure as already mentioned in other answers.
If still not working, and long-pressing the link in mail or notes app fails to show "Open with [your app]" then try restarting your phone. More than a few times this has been the solution for me!
The Apple validator checks some other things that are not necessary for Universal Links to work, and unfortunately that often results on false positive error messages. The file at https://couchsurfing.com/apple-app-site-association looks good to me, and it passes this validator just fine.
When clicking on a valid link, does the app not open, or just the delegate methods don't fire? These are two very different issues and would have different solutions. There are some troubleshooting steps you could try here, though some of those are specific to the Branch.io (full disclosure: I'm on the Branch team) linking platform.
As some sort of completion to the answers above (took me hours to find out):
The app needs to be installed AFTER you added your "apple-app-site-association" file to the server, as the file initially got fetched / checked after the installation.

Is it possible to deploy both the iphone and ipad *.ipa to the Application Center?

I am able to build both the iphone and ipad ipa files (app.ipa and app-ipad.ipa) fine. However, when I go to deploy them to the Application Center via the native-deployer api,
the Application Center only shows one app of type "ios", where I expect two apps, one for iphone and one for ipad.
Since this is one worklight project. The application-descriptor is the same. The version number and bundle ids are exactly the same. What do I need to change to differentiate them?
I think if the bundle id is different Application Center will discern them, for sure. But worklight did not change the bundle id when I added the environment, so I left them unchanged.
The bundleId value in application-descriptor.xml for the iPad and iPhone environments is merely a placeholder. Obviously, you need to change it.
You can change it either in application-descriptor.xml, in which case it will be pre-set by the time you open the generated Xcode project in Xcode. Or you can set it when you open the project in Xcode.
The simplest way is to just set it in application-descriptor.xml...
Note that Worklight has got nothing to do with your iOS app once it is generated and you want to release it. Any and all configurations are then mostly related to Xcode settings of your application. Read more here:
Configuring Your Xcode Project for Distribution
Another thing to note is that a Worklight-based iOS app, be it the iPhone or iPad environment is configured as a Universal app by default (fit for both iPhone and iPad). Perhaps what is missing in your case is to differentiate the two.
In Xode, for each project (iPhone and iPad), look for the setting to set it as an iPhone or iPad app, rather than Universal app.
Then, try uploading to the Application Center management console again and check if you are now able to see TWO apps.

Resources