Search code examples
iosobjective-cios9ios-universal-linksitunes-search-api

Universal Links iOS


I am having some trouble in getting Universal links on my app working. Here are the things that i have already done.

-- Created my apple-app-site-association file. Here is my file

{

    "applinks": {
                "apps": [],
                "details": [{
                    "appID": "XXXXXXXXXX.com.companyName.app",
                    "paths": ["/view/*", "/class/*"]
                }]
            }
}

I have not signed my file and i set my project deployment target to iOS 9.2 (so that i don't have to sign this file).

-- Added the associated domain in my project capabilities

applinks:companyName.com
applinks:www.companyName.com

-- Associated domains are also enabled in my developer portal

-- Updated the provisioning profiles and used the new ones

-- Added the entitlement to the build.

-- Overrided this delegate method

- (BOOL)application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity restorationHandler:(void (^)(NSArray *))restorationHandler

The file is available from my HTTPS server and i checked the universal links status from this apple validator. https://search.developer.apple.com/appsearch-validation-tool/ The validator is validating this. But when i click on the link which is in iMessage and the link is like companyName.com/view/7375, then it will open in safari and my app does not get any call back.

Any idea what i am missing


Solution

  • It may be that the OS now considers handling your URL in "override" mode -- why it goes into Safari.

    When your app resolves a Universal Link, in the upper-right corner of the screen you'll see someting like "companyName.com -->". If you tap that, that's the OS's way of "overriding" how the Universal Link is handled, and opens it in Safari at that time and forevermore.

    Try going back into the Messages app and long press on your link. After a second or two, you should see an action sheet come up that gives you options like "Open in Safari" and "Open in 'Your App Name'". Select the "open in your name" option. That should then "reset" how the OS views handling your Universal Links, now directing them back into your app.