gpt4 book ai didi

ios - AuthDataResult 类型的值没有成员 providerID

转载 作者:塔克拉玛干 更新时间:2023-11-02 20:28:18 25 4
gpt4 key购买 nike

我正在经历这个令人沮丧的问题。令人恼火的是,他们为 Firebase 进行了这样的更新,几乎没有特定文档。我收到同样的错误:“AuthDataResult”类型的值没有成员“providerID”。这是我的代码:

                if let user = user {
if self.segmentedControl.selectedSegmentIndex == 0 {
let userData = ["provider": user.providerID] as [String: Any]
DataService.instance.createFirebaseDBUser(uid: user.uid, userData: userData, isDriver: false)
} else {
let userData = ["provider": user.providerID, USER_IS_DRIVER: true, ACCOUNT_PICKUP_MODE_ENABLED: false, DRIVER_IS_ON_TRIP: false] as [String: Any]
DataService.instance.createFirebaseDBUser(uid: user.uid, userData: userData, isDriver: true)
}
}

最佳答案

问题是代码中名为 user 的对象不是 FIRUser,而是错误指示的 AuthDataResult

let authdataresult = // the thing you were calling user
let user = authdataresult.user // this is a FIRUser
let providerData = user.providerData // this is FIRUserInfo
let providerId = providerData.providerId

关于ios - AuthDataResult 类型的值没有成员 providerID,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54384340/

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