【发布时间】:2018-11-09 03:38:24
【问题描述】:
我正在使用此代码
var currentTimeStamp: TimeInterval?
let ref = Database.database().reference().child("serverTimestamp")
ref.setValue(ServerValue.timestamp())
ref.observe(.value, with: { snap in
if let t = snap.value as? Timestamp {
// print(t/1000)
// currentTimeStamp = t/1000
//Add additional data(Timestamp) to list
mutableData["timestamp"] = currentTimeStamp
//FINALLY , set data
newdoc.setData(mutableData) { (error) in
completion(docID)
}
}
})
收到此错误
Firebase/Database][I-RDB038012] Listener at /serverTimestamp failed: permission_denied
我的规则设置为 Auth ,但 auth 用户仍然无法获取时间戳
// These rules grant access to a node matching the authenticated
// user's ID from the Firebase auth token
{
"rules": {
"users": {
"$uid": {
".read": "$uid === auth.uid",
".write": "$uid === auth.uid"
}
}
}
}
我想在 Firebase 实时数据库当前结构中写入时间戳是 .
我的项目 [null] |____ 服务器时间戳:1
我以为我已经设置了完成公开的规则仍然无法获取时间戳
【问题讨论】:
标签: ios swift firebase firebase-realtime-database