gpt4 book ai didi

ios - 使用未解析的标识符 'connections' ;你是说 Auth0 中的 'Connections' 吗?

转载 作者:可可西里 更新时间:2023-11-01 00:28:40 25 4
gpt4 key购买 nike

我正在处理 Auth0 Lock 集成,我收到错误 Use of unresolved identifier 'connections';您是说“连接”吗?

.withConnections {_ in
connections.database(name: "Username-Password-Authentication", requiresUsername: true)
}

我将代码更改为

Connections.database(name: "Username-Password-Authentication", requiresUsername: true) 

现在我收到错误消息Instance member 'database' cannot be used on type 'Connections'

当我将代码更改为

Connections().database(name: "Username-Password-Authentication", requiresUsername: true)

获取错误'Connections' cannot be constructed because it has no accessible initializers

我将代码更改为

$0.database(name: "Username-Password-Authentication", requiresUsername: true)

获取不能在具有显式参数的闭包内使用匿名闭包参数

https://github.com/auth0/Lock.swift

https://auth0.com/docs/libraries/lock-ios/v2#configuration-options

override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.

Lock
.classic()
// withConnections, withOptions, withStyle, and so on
.withOptions {
$0.oidcConformant = true
$0.scope = "openid profile"
}
.onAuth { credentials in
// Let's save our credentials.accessToken value
}
.withConnections {_ in
connections.database(name: "Username-Password-Authentication", requiresUsername: true)
}
.withStyle {
$0.title = "Company LLC"
$0.logo = LazyImage(name: "123.png")
$0.primaryColor = UIColor(red: 0.6784, green: 0.5412, blue: 0.7333, alpha: 1.0)
}
.present(from: self)

最佳答案

似乎 Auth0 文档在这里是错误的。如果您查看 Lock.swift source file您会看到 ConnectionBuildable 作为参数传递。您需要使用它来建立联系。

试试这个:

.withConnections { connections in
connections.database(name: "Username-Password-Authentication", requiresUsername: true)
}

或者使用匿名闭包参数做同样的事情:

.withConnections {
$0.database(name: "Username-Password-Authentication", requiresUsername: true)
}

关于ios - 使用未解析的标识符 'connections' ;你是说 Auth0 中的 'Connections' 吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54305394/

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