问题
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