我有一个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])
}
}
答案 0 :(得分:0)
您应该创建一个字典以使用updateChildValues
发送数据。