[英]type [String: String] does not conform to protocol 'AnyObject'
I am trying to create a new path called USERSLIST
in my JSON structure! 我正在尝试在JSON结构中创建一个名为
USERSLIST
的新路径! it will have the list of users that have created account in my firebase app. 它将包含在我的Firebase应用程序中创建帐户的用户列表。 and in my JSON it must look like this :
在我的JSON中,它必须看起来像这样:
USERSLIST:
用户列表:
- simpleLogin6 : aa@gmail.com
simpleLogin6:aa@gmail.com
- simpleLogin9 : bb@gmail.com
simpleLogin9:bb@gmail.com
it should have the uid
of the account created as the key and email as the value. 它应该以创建帐户的
uid
作为键,并以email作为值。
I wrote this code : 我写了这段代码:
var usersList = [self.ref.authData.uid : authData.providerData["email"] as? NSString as? String,]
self.ref.childByAppendingPath("userList").childByAutoId().setValue(usersList)
But it shows an error in the setValue
line code that : 但是它在
setValue
行代码中显示了一个错误:
type [String: String] does not conform to protocol 'AnyObject'
var userList = [String:String]()
if let strEmail = authData.providerData["email"] {
usersList[self.ref.authData.uid] = strEmail as! String
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.