Firebase本地通知 [英] Firebase local notifications
本文介绍了Firebase本地通知的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
[火力地堡setDispatchQueue:dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT,0)];
解决方案
$ b
1) observeEventType
方法在 firebase数据库中发生任何更改时调用$
$ b $ $ b
//下面的语句指向你的数据库。
let ref = FIRDatabase.database()。reference()
ref.observeEventType(.Value,withBlock:{(snapshot) - >
print(snapshot。值)
//将您的本地通知代码放在这里...
$)
$ / code $ <$ pre
Is there any possibility to fire local notification when there is a callback from Firebase ? I've got a problem with threads I guess,
[Firebase setDispatchQueue:dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0)];
解决方案 You can achieve above functionality as follow.
1 ) observeEventType
method is call when any changes occurs in firebase database
2 ) Implement observeEventType
method as follow.
// Below statement is point to your database.
let ref = FIRDatabase.database().reference()
ref.observeEventType(.Value,withBlock:{ (snapshot) -> Void in
print(snapshot.value)
// Put your local notification code here...
})
这篇关于Firebase本地通知的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文