我有一个 facebook 和 twitter 登录按钮。我关注user guide .我想存储用户信息,但收到此错误 Could not cast value of type 'FIRUserInfoImpl' to 'NSDictionary'
我不确定为什么我不能存储相关数据。是因为提供者数据与对象类型不匹配吗?
func createFirebaseUser(){
//MARK: Assign what to get from current User data.
let key = ref.child("users").childByAutoId().key
if let user = FIRAuth.auth()?.currentUser{
for profile in user.providerData {
let userID = profile.uid as! String!
let username = profile.displayName as! String!
let email = profile.email as! String!
let profilePicUrl = profile.photoURL as! NSURL!
ref.child("users").updateChildValues(profile as? NSDictionary as! [NSObject : AnyObject])
}
}
最佳答案
您应该创建一个字典来使用 updateChildValues
发送数据。
关于swift - Firebase swift - 无法将类型 'FIRUserInfoImpl' 的值转换为 'NSDictionary',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37831821/