Firebase local notifications

二次信任 提交于 2019-12-09 03:24:57

问题


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)];

回答1:


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...
   })


来源:https://stackoverflow.com/questions/25569816/firebase-local-notifications

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!