gpt4 book ai didi

ios - 收到此错误 : Initializer for conditional binding must have Optional type, 而不是 'Bool'

转载 作者:行者123 更新时间:2023-11-28 10:06:09 25 4
gpt4 key购买 nike

func application(_ app: UIApplication, open url: URL, options:
[UIApplicationOpenURLOptionsKey : Any] = [:]) -> Bool {

if let isDynamicLink = DynamicLinks.dynamicLinks() .shouldHandleDynamicLink(fromCustomSchemeURL: url) {
let dynamicLink = DynamicLinks.dynamicLinks().dynamicLink(fromCustomSchemeURL: url)
return handleDynamicLink(dynamicLink)
}
return true
}

最佳答案

⌥-click shouldHandleDynamicLink 你会看到声明

func shouldHandleDynamicLink(fromCustomSchemeURL url: URL) -> Bool

返回类型是非可选的。删除可选绑定(bind)

func application(_ app: UIApplication, open url: URL, options:
[UIApplicationOpenURLOptionsKey : Any] = [:]) -> Bool {

if DynamicLinks.dynamicLinks().shouldHandleDynamicLink(fromCustomSchemeURL: url) {
let dynamicLink = DynamicLinks.dynamicLinks().dynamicLink(fromCustomSchemeURL: url)
return handleDynamicLink(dynamicLink)
}
return true
}

关于ios - 收到此错误 : Initializer for conditional binding must have Optional type, 而不是 'Bool',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53391043/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com