iosurldeep-linking

how do i open same app using Deeplinking through universal links


I am having an already running app on Appstore. I have implemented Deepliking through Universal links and it is working perfectly when I open app from anyother app, by clicking a specified URL.

But there is a scenario in which it is kind of failing to work. I have a button in my app, which calls openurl and open's the URL which is connected with my app using deeplinking. Instead of calling my deeplinking handler ,

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

the App opens the browser and opens the URL there.

So here's what is I am getting:

enter image description here

And this is what is Required

enter image description here

Any help would be appreciated.


Solution

  • I posted this question few years ago and forgot about it, although I have been using a solution that seems quiet straight forward.

    For any deeplink we can create a method like func processDeeplink(for url: URL) which inputs our URL and process it according to the path. Depending on the code architecture we can place it in either a shared class or AppDelegate instance.

    Now in our app, when we need to trigger the deeplink of our own app, we would just detect the domain and call our own method which would process the deeplink.

    In a nutshell: No need to add any specific configuration in Associated Domains. Just call your own method to process the deeplink.