【发布时间】:2015-09-09 09:56:25
【问题描述】:
我正在尝试在我的 JSON 结构中创建一个名为 USERSLIST 的新路径!它将包含在我的 firebase 应用程序中创建帐户的用户列表。在我的 JSON 中,它必须看起来像这样:
用户列表:
- simpleLogin6:aa@gmail.com
- simpleLogin9 : bb@gmail.com
它应该将创建的帐户的uid 作为键,将电子邮件作为值。
我写了这段代码:
var usersList = [self.ref.authData.uid : authData.providerData["email"] as? NSString as? String,]
self.ref.childByAppendingPath("userList").childByAutoId().setValue(usersList)
但它在setValue 行代码中显示错误:
type [String: String] does not conform to protocol 'AnyObject'
【问题讨论】:
-
authData的类型是什么?您能否向我们展示更多代码以了解所有变量?
标签: ios json swift nsstring firebase