0

I am trying to implement universal linking in an app, and everything works well when the app is in the background. But when the app isn't loaded already, it will flash the correct screen for like a tenth of a second before it goes back to the root view controller. Not sure what's happening here, anyone have any insight? The project only has AppDelegate, no SceneDelegate. continueWithLink will go to the correct VC, and is not the issue.

in my app delegate file:

didFinishLaunchingWithOptions

if let url = launchOptions?[UIApplication.LaunchOptionsKey.url] as? URL {
            self.continueWithLink(url: url)
        } else if let activityDictionary = launchOptions?[UIApplication.LaunchOptionsKey.userActivityDictionary] as? [AnyHashable: Any] {
            for key in activityDictionary.keys {
                if let userActivity = activityDictionary[key] as? NSUserActivity {
                       if let url = userActivity.webpageURL {
                        self.continueWithLink(url: url)
                    }
                }
            }
        }


func application(_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void) -> Bool {
        
        if let url = userActivity.webpageURL {
            self.continueWithLink(url: url)
        }
}
Noah Iarrobino
  • 1,435
  • 1
  • 10
  • 31
  • What is the code in `continueWithLink`? It looks like it is presenting the view controller you want, but not setting the root view controller of the main window - So the normal (presumably storyboard based) initial scene is shown – Paulw11 Apr 24 '21 at 22:45
  • ```continueWithLink``` sets the rootView controller to the desired continued VC – Noah Iarrobino Apr 25 '21 at 05:14

0 Answers0