当我通过myapp://param1=abc
打开应用程序时,未调用open url函数。
正如Apple文档所说,我已经添加了功能didFinishlaunchingWithOptions
和willFinishlaunchingWithOptions
使其成为true
,但仍未调用。该应用程序可以完美打开,但没有调用函数open url,我无法获取param1
这是我的AppDelegate
文件:
class AppDelegate: UIResponder,UIApplicationDelegate {
func application(_ application: UIApplication,didFinishlaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool {
return true
}
func application(_ application: UIApplication,willFinishlaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool {
return true
}
func application(_ application: UIApplication,open url: URL,options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool {
// Here doesn't come! :(
return true
}
// MARK: UIScenesession Lifecycle
func application(_ application: UIApplication,configurationForConnecting connectingScenesession: UIScenesession,options: UIScene.ConnectionOptions) -> UISceneConfiguration {
// Called when a new scene session is being created.
// Use this method to select a configuration to create the new scene with.
return UISceneConfiguration(name: "Default Configuration",sessionRole: connectingScenesession.role)
}
func application(_ application: UIApplication,didDiscardScenesessions scenesessions: Set<UIScenesession>) {
// Called when the user discards a scene session.
// If any sessions were discarded while the application was not running,this will be called shortly after application:didFinishlaunchingWithOptions.
// Use this method to release any resources that were specific to the discarded scenes,as they will not return.
}
}
有什么想法吗?
谢谢!