ios - Firebase 规则:无法始终如一地工作
问题描述
我正在使用一种结构来将用户朋友保存在实时数据库中,如下所示:
friends
$user_id:
-$friend_id1
-name: ""
-id: ""
-$friend_id2
(...)
我的规则如下所示:
"friends":{
"$id": {
".read": "auth != null && $id === auth.uid",
".write": false,
},
},
在我的 iOS 应用程序中,我可以访问其他人的朋友,尽管我不应该这样做。此外,这似乎主要是一个单一视图中的问题,因为当我更改
"read": false
我仍然可以在该特定视图中读取此数据。然而,在所有其他视图中,我不能这样做,尽管代码几乎相同(除了观察 ( .childAdded
) 而不是 ( .value
)。
我在打电话
let friends_ref = Database.database().reference().child("friends").child(self.friend_id)
friends_ref.observeSingleEvent(of: .value, with: { (snapshot) in
//CODE
})
此外,加载好友所需的时间,因此获得回调,甚至需要 >5 秒才能获得 5 个好友。
这怎么可能发生?
此致
解决方案
推荐阅读
- c# - 不能在简单的控制台应用程序中使用 Console.Readline()?
- node.js - AWS - 如何从 NodeJs Lamda 中的令牌中获取用户名?
- javascript - 使元素 100% 为其祖父元素的宽度
- python - 如何通过重新排序重塑 numpy 数组?
- azure-ad-b2c - 无法获取段落 InputType 以在 Azure B2C IEF 中显示任何文本
- javascript - 如何在 Postman javascript 中从谷歌云存储 (GCS) 中读取 zip 文件中的内容
- unity3d - FPS 在场景中生成不好(多人游戏)
- typescript - How to write a unit test in Typescript?
- php - 关于字段 Googlemap 的 wordpress 问题的 acf
- linux - 将进程限制为特定数量的 CPU