【发布时间】:2019-07-24 07:25:21
【问题描述】:
我在我的应用程序 url 方案中使用,我不知道为什么当我点击 URL(例如 https://api.domain.com/menu?id=7ee5232764-0a79-4afe)时有时 iOS 打开我的应用程序(正确),1 秒后打开 App Store应用程序(不正确)。这是我的openUrl的方法:
func application(_ application: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:] ) -> Bool {
let components = url.absoluteString.components(separatedBy: "/")
if components.contains("menus") {
let menuId = url.lastPathComponent
let menu = Menu(id: menuId)
SessionManager.shared.navigationManager.present(NavigationItem.menu(menu: menu).viewController, animated: true, completion: nil)
return true
} else {
return false
}
}
【问题讨论】:
-
您是否在单击 url 时调用上述函数时添加了断点。
-
他发布的网址是否只是为我打开了一个性链接?
-
我不认为点击这个 xxx 是个好主意。 com 链接。
-
我用“xxx”代替原来的链接。 @MandeepSingh 是的,我使用了断点,它在 if 中正确输入。
标签: ios swift url-scheme