Manish
Manish

Reputation: 11

universal links not working swift 3

I have implemented universal links in my app with following steps :-

My universal link is not working I am not able to redirect my app from links in notes or from any place. I have implemented all the neccessary steps I know. I am not able to debug the issue.

Upvotes: 0

Views: 779

Answers (2)

Akilan C B
Akilan C B

Reputation: 371

You mentioned it as txt file but it should be a file with no extension and the name of the file should be "apple-app-site-association" and it must be present in root directory or .well-known directory in your server.

Check this article:

https://developer.apple.com/documentation/xcode/supporting-associated-domains

Upvotes: 0

Abdullah Jafar
Abdullah Jafar

Reputation: 104

Your AppDelegate implementation is not complete yet, you need to get your url from the received NSUserActivity object as declared here in apple documentations, use following method to complete your appDelegate implementation:

func application(_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([Any]?) -> Void) -> Bool {

        guard userActivity.activityType == NSUserActivityTypeBrowsingWeb,
            let url = userActivity.webpageURL

            else
        {return false}

        return true
}

Then, you can use this url and send it to whatever ViewController want to load it in. Hope this helps;)

Upvotes: 1

Related Questions