我假设 postPath 在其中有多个子分支名称,使其成为路径。你的意思是指的是帖子的uid吗?如果没有,你介意发布你的分支的屏幕截图 Likes ?有什么价值 postPath 和 post?.media[index].numberMedia
postPath
Likes
post?.media[index].numberMedia
另外,该行:
self.databaseRef.child("Likes").child((self.post?.user.userID)!).child(self.postPath).child((self.post?.media[index].numberMedia)!).updateChildValues([Auth.auth().currentUser?.uid : true])
找到一个像4个分支深的子分支。要么您没有扇出数据结构,要么您正在接近错误地找到值?
的 编辑 强> :
尝试换掉
.updateChildValues([Auth.auth().currentUser?.uid : true])
对于
.child(Auth.auth().currentUser?.uid).setValue(true)