![](/img/trans.png)
[英]Cannot call value of non-function type '((UInt) -> Data?)!'
[英]How to fix “Cannot call value of non-function type [UserInfo]” while trying to retrieve provider's data?
我正在嘗試檢索FirebaseUser提供程序的數據,但是Swift調試器返回了錯誤
無法調用非功能類型“ [UserInfo]”的值
從下面的圖片中我的代碼可以看出:
let providData = userInstance.providerData {
for profile in providerData {
if profile.providerID == "facebook.com" {
let fbUserId = profile.uid
fbProfilePicUrl = "https://graph.facebook.com/\(fbUserId)/picture?height=300"
self.profilePicUrl = fbProfilePicUrl
}else if profile.providerID == "google.com" {
let googleUserId = profile.uid
//self.profilePicUrl = .....
}
}
}
有人可以告訴我怎么了嗎?
providerData
是FIRUser
check 在此處的數組屬性,您不能在其后使用{ ,因此您需要
for profile in user.providerData {
if profile.providerID == "facebook.com" {
let fbUserId = profile.uid
fbProfilePicUrl = "https://graph.facebook.com/\(fbUserId)/picture?height=300"
self.profilePicUrl = fbProfilePicUrl
}else if profile.providerID == "google.com" {
let googleUserId = profile.uid
//self.profilePicUrl = .....
}
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.