【发布时间】:2019-11-29 18:20:18
【问题描述】:
在下面的代码中,我试图将字符串 uids 附加到字典中,问题是当我这样做时,似乎字典在每次迭代后都会被重置。我该如何解决这个问题?
func getFollowing() {
self.ref.child("Following").child(uid)
.observeSingleEvent(of: .value, with: { (snapshot) in
if let data = snapshot.value as? [String:[String : Any]] {
for key in data.keys {
var dict = (UIApplication.shared.delegate as! AppDelegate).usersCurrentUserIsFollowing
dict[key] = true
print(dict, " this is gtteh dict now dhfsakflk")
}
}
})
}
【问题讨论】:
标签: ios swift firebase dictionary firebase-realtime-database