通用链接在实际装置上不起作用
原标题: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:.
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:///.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 serverside 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.
Mojtaba Hosseini is correct with his answer, I just want to add some more information.
Not only is the apple-app-site-association file cached on the Apple CDN (there are ways to check the cache expiration date), but your device itself downloads the file only very rarely.
There are sites online that validate your configuration file - look them up. One common error is not returning the correct response header for Content-Type (must be application/json). If you still think everything is set up correctly and the link still doesn t open your app, there are two more reliable ways to test your configuration:
1. Use alternate developer mode
In your Signing & Capabilities tab in Xcode, append ?mode=developerto your URL (e.g. applinks:URL.COM?mode=developer). This bypasses Apple s CDN and makes your device fetch the apple-app-site-association file directly from your server. Make sure you enable the corresponding option in the developer settings of your device. [Source]
2. Use a simulator
Your development device might have an old version of the file cached. Simply boot up a simulator and type the following into your terminal:
xcrun simctl openurl booted ""
(this is needed because you can t put the link in the Notes or Message app on simulator)
If your app still does not open, there is a high chance something is wrong with your configuration.
相关问题
When to use restoreCompletedTransactions for in-app purchases?
For a basic app with nonconsumable in-app purchases, has anyone figured out best practices for using SKPaymentQueue s restoreCompletedTransactions?
Observations
I know it s recommended to always ...
List Contents of Directory in a UITableView
I am trying to list the contents of Ringtones directory in a TableView, however, I am only getting the last file in the directory in ALL cells, instead of file per cell. This is my code:
- (...
Telling a UITextField to become first responder while embedded in a UITableViewCell
I have a UITextField that is a subview of a UITableViewCell.
When my view loads, I want the text field to become first responder. I have a pointer to the text field in the table cell, so to do this I ...
iPhone In-App Purchase Store Kit error -1003 "Cannot connect to iTunes Store"
I ve been working on adding in-app purchases and was able to create and test in-app purchases using Store Kit (yay!). During testing, I exercised my app in a way which caused the app to crash mid ...
iPhone NSUserDefaults persistance difficulty
In my app i have a bunch of data i store in the NSUserdefaults. This information consists of an NSObject (Object1) with NSStrings and NSNumbers and also 2 instances of yet another object (Object2). ...
Writing a masked image to disk as a PNG file
Basically I m downloading images off of a webserver and then caching them to the disk, but before I do so I want to mask them.
I m using the masking code everyone seems to point at which can be found ...
Resize UIImage with aspect ratio?
I m using this code to resize an image on the iPhone:
CGRect screenRect = CGRectMake(0, 0, 320.0, 480.0);
UIGraphicsBeginImageContext(screenRect.size);
[value drawInRect:screenRect blendMode:...
Allowing interaction with a UIView under another UIView
Is there a simple way of allowing interaction with a button in a UIView that lies under another UIView - where there are no actual objects from the top UIView on top of the button?
For instance, ...