Firebase数据库更新不会更新

时间:2020-04-12 14:33:07

标签: ios swift database google-cloud-firestore

我想更新我的Firebase数据库。但这不起作用。

这是我的代码:

func loadData(url: URL){
    let ref = Database.database().reference().child("posts")
    let user = UserService.currentUserProfile!

    ref.queryOrdered(byChild: "author/username").queryEqual(toValue: user.username).observe(.value, with: { snapshot in
        if var post = snapshot.value as? [String : Any] {
            print("updated all Posts")
            post.updateValue(url.absoluteString, forKey: "photoUrl")
            print(post.values)


        }else{
            print("fail")
        }
})
}

0 个答案:

没有答案