Universal Links not working on a SwiftUI app - ios

I am working on a little app using SwiftUI and CoreLocation.
It is starting to behave the way I want. But at this point, I am having difficuties to integrate Universal Links.
In Xcode (version 11.6), I have added the Associated Domain:
applinks:mydomain.example.net
I have also checked: Associated Domains (not MDM Managed Associated Domains) in the App Identifier (On the Developper Portal).
On my website (https://mydomain.example.net) I have placed the apple-app-site-association file in .well-known/ under the root directory.
This is the shape of the file:
{
"applinks": {
"apps": [],
"details": [
{
"appID": "1122334455.my.app.bundle.MyApp",
"paths": ["*"]
}
]
},
"webcredentials": {
"apps": ["1122334455.my.app.bundle.MyApp"]
}
}
And in the SceneDelegate.swift file, I have added this method:
func scene(_ scene: UIScene, continue userActivity: NSUserActivity) {
print(#function)
// TESTING-CODE
... change app-background to RED!
}
Thinking it should be called when pointing Safari to https://mydomain.example.net/somefile, on a device where the app is installed.
But it never seems to be called, and my Universal Links experiment is not working.
I have tried both launching the app on my device from Xcode and launching the app on my device after it has been uploaded to TestFlight. Both failed; I must be missing something, maybe basic, but I just don't know.
Can anyone point me in the right direction to finding the solution to my problem?

Related

iOS Universal Links redirect to AppStore to Update Application

I am working on a feature that implementing of 3rd party sdk (Firebase etc) to handle Universal Links in iOS and my apple-app-site-association file is like below.
{
"applinks": {
"apps": [],
"details": [
{
"appID": "teamid.bundleid",
"paths": [
"NOT /auth",
"/*"
]
},
]
}
}
Everything is working fine but in a domain like myappsite.com/deeplink/live-chat it goes directly to the AppStore but the problem here is my application is already installed on the phone, when I go to AppStore, there is a button named Update for updating application then nothing changed, do you have any idea of this problem?

Universal links deep linking not working for certain links

Our app has enabled deeplinking using universal links
This is what the AASA file on the server looks like
{
"applinks": {
"apps": [],
"details": [{
"appID": "team.com.company.product",
"paths": ["/dashboards/*", "/lakes/*", "/dashboards-next/*", "/embed/lakes/*"]
}]
}
}
This is the manifest file
<string>applinks:*.company.com/dashboards</string>
<string>applinks:*.company.com/lakes</string>
<string>applinks:*.company.com/dashboards-next</string>
<string>applinks:*.company.com/embed/lakes</string>
The "/dashboards/*", "/lakes/*", "/dashboards-next/*" seem to working fine with the app but
"/embed/lakes/*" urls don't seem to working
Eg:
https://base.dev.company.com/lakes/jCzwyW924vnnh4k5Yx7B8t9H99j4Rhd9 works fine
https://base.dev.company.com/embed/lakes/jCzwyW924vdnhFk5Yx7B8t9H99j4Rhd9 doesn't work
The issue turned out to be that the manifest file was updated and hosted on the subdomain but it wasn't updated on the main domain.

Why does iOS Universal link stopped working in 12.2

Universal link was working fine till iOS 12.1. It has stopped working in iOS 12.2. I was using XCode 10.1 swift 4, to debug code in 12.2 updated my xcode to 10.2 , swift 4.
I have checked the apple-app-site-association which is fine. Application is downloading it perfectly. Path, activitycontinuation, details looks fine. Associated domains are present in entitlements files.
This code works/setup fine when running < 12.2.
{
"activitycontinuation": {
"apps": [
“teamID.bundleidentifier”
]
},
"applinks": {
"apps": [],
"details": [
{
"appID": “teamID.bundleidentifier”,
"paths": [ "/validate", "/redirect", "NOT /*" ]
}
]
}
}
Apple has added some changes related to security, is this the reason of not working.
Apple has asked me to create a bug for them. They think it’s most likely a bug I am running up against.
Can you try by replacing teamID with the app prefix in the appID under details of apple-app-site-association file. also keep the apps section empty.

Universal Links don't redirect the user to my app when tapped

I implemented Universal Links in my app, and it works like charm.
But after the iOS 9.2 Update it stopped working.
When the app is already installed, and I tap on the link which in iOS9.1 open my app, in iOS9.2 it isn't.
Does anyone have the same problem?
My problem was an old format for the apple-app-site-association.
The old format was:
{
"applinks": {
"apps": [],
"details": {
"1234ABCDE.com.app.myapp": {
"paths": [
"*"
]
}
}
}
}
Update the format fixed the problem, and the new format is:
{
"applinks": {
"apps": [],
"details": [
{
"appID": "1234ABCDE.com.app.myapp",
"paths": ["*"]
}
]
}
}
Can check if the format is right here:
https://search.developer.apple.com/appsearch-validation-tool/
If it says: recommended - old format, so it won't work on iOS9.2, So update to the new format.
Hope it help someone.
This is a known issue introduced with iOS 9.2. Please see https://blog.branch.io/ios-9.2-redirection-update-uri-scheme-and-universal-links for a full description of the issue.
TLDR - It's not known if this was intentional or a bug on Apple's part. What is known is that with the update to iOS 9.2, the model dialog which was previously used to prompt the user to open the app (associated with the URL scheme) is no longer modal. This means that javascript execution continues and if you were previously counting on the modal dialog to prevent redirecting the user to the app store, that no longer works. The end user experience for most apps using URL schemes is that they are ALWAYS redirected to the app store where the button says "open" instead of "get" for the app.

iOS 9 Universal Links don't work

I tried to implement universal links in my application, but it's not working. I uploaded the apple-app-site-association file to my server, i can access it.
(MIME type: application/json)
Here is the content of the apple-app-site-association file:
{
"applinks": {
"apps": [],
"details": [
{
"appID": "L7LAMSGWAK.com.example.app",
"paths": [
"*"
]
} ]
}
}
I turned on the Associated domains in my application, and i added these domains:
applinks:example.com
applinks:demo.example.com
(i uploaded the apple-app-site-association file to the demo.example.com domain too)
In the AppDelegate.m file i wrote this:
- (BOOL)application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity restorationHandler:(void (^)(NSArray *restorableObjects))restorationHandler {
NSURL* openedUrl = userActivity.webpageURL;
NSString* urlString = [openedUrl.absoluteString lowercaseString];
return YES;
}
And i set a breakpoint into this method to check if its called, but its never called. If i click on for example this link: https://demo.example.com/asd its just open the safari, but i never see the banner to open the link in my application. I really dont know whats wrong.
Try to delete and reinstall the app. iOS processes associated domain details and attempts to read the apple-app-site-association file at app install. It worth trying it with a real device (instead of the Simulator) and check device logs (Xcode > Window > Devices and select your device). If you see anything like ### Rejecting URL 'https://demo.example.com/apple-app-site-association' for auth method 'NSURLAuthenticationMethodServerTrust': -6754/0xFFFFE59E kAuthenticationErr, then probably your site's certificate is not good enough for iOS or there is some other issue with downloading your association file.
Kind of a late answer, but I had the same problem when I was trying to implement universal links. The solution for me was to test using a real device.
The Apple documentation lists that it's possible to test on a simulator, but with my own experience, it hasn't been possible.
You can test universal links in Simulator or on a device. Source - Apple
I also tried using Branch.io and they state that it's not possible to test using a simulator.
You should also verify that you're using a device that's running iOS >= 9.2

Resources