John Leonardo John Leonardo - 1 year ago 171
iOS Question

Firebase observe with type .childAdded retrieves all my information every time. Please assist

According to Firebase docs:

ChildAdded is triggered once for each existing child and then again every time a new child is added to the specified path

So, I have an app, that has a little banner at the top that pops up every time a user gets a new message. As you could have guessed, these messages are stored in a child in the user object in Firebase. So, here's the problem, when I load the app, it pops up for EVERY message the user has. Is it possible to have this observe event ONLY be called when a new child is added? I don't want it to be triggered for every single existing child, only when a new one is added. I would hate to have to store message references in core data, and do a check for every child to see if it already exists in core data :/

Answer Source

A few ways to do this:

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download