【发布时间】:2016-08-18 06:21:39
【问题描述】:
当我回复一个 PN 时,我正在处理交互式推送通知,这应该是更新 firbase 数据库。它不能很好地工作,因为有时如果应用程序在后台,数据不会实时同步。但是当你打开应用程序时,它会推送数据
如果应用处于终止状态,则回复甚至不会发送到 Firebase DB
Ref.child(uId).runTransactionBlock({ (currentData: FIRMutableData) -> FIRTransactionResult in
var value = currentData.value as? [String : AnyObject]
if value == nil {
return FIRTransactionResult.success(withValue: currentData)
}
let totR = value!["totalReply"] as? Int ?? 0
print(totR)
value?["totalReply"] = totR + 1
currentData.value = value
}
【问题讨论】:
标签: ios swift firebase firebase-realtime-database firebase-notifications