-1

In our app we have a deeplink that when tapped it opens the app to our homepage and then do a push to another section.

When the app is open in the background it works properly but when the app is completely closed it just opens the app, land in the homePage and it stays there.

In the AppDelegate we handle deeplinks in this way:

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

        guard userActivity.activityType == NSUserActivityTypeBrowsingWeb,
            let incomingURL = userActivity.webpageURL else { return false }
     
            // Here we call a method to handle the deeplink and open the correct page
      
        return true
    }

Here is our json file for the deeplinks

{
 "applinks": {
   "apps": [],
   "details": [
     {
       "appID": "appIdOne",
       "paths": [
         "*"
       ]
     },
     {
       "appID": "appIdTwo",
       "paths": [
         "*"
       ]
     },
     {
       "appID": "appIdThree",
       "paths": [
         "*"
       ]
     }
   ]
 }
}

Is there something missing?

Reading another answer to a similar question iOS Deep link callbacks not working when the app is closed

the issue may be that we don't have "content_available" : true field in our file. If it's the case where should we add that field?

Thanks in advance.

Dávid Pásztor
  • 51,403
  • 9
  • 85
  • 116
I Don't Tell
  • 264
  • 1
  • 15
  • 1
    Take a look at https://stackoverflow.com/questions/42345586/application-openurl-gets-called-a-few-seconds-after-didfinishlaunchingwithoption. You need to handle deep links in application:didFinishLaunchingWithOptions: if the app was not in background – Antanas Nov 03 '22 at 17:40

1 Answers1

-1

As suggested by Antanas I solved it by handling the deeplink management in application:didFinishLaunchingWithOptions: method which is called when the app opens. Instead when the app is completely closed application: UIApplication, continue userActivity: NSUserActivity is not going to be called.

I Don't Tell
  • 264
  • 1
  • 15