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)
}
}