我正在尝试在应用程序中实现通用链接,并且当应用程序在后台时一切正常。但是当应用程序尚未加载时,它会在返回根视图控制器之前闪烁正确的屏幕大约十分之一秒。不知道这里发生了什么,有人有任何见解吗?该项目只有AppDelegate,没有SceneDelegate。continueWithLink
会去正确的VC,这不是问题。
在我的应用委托文件中:
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)
}
}