简体   繁体   中英

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM