0

I got posts in my post node and I've made a wall node for keeping reference to post.

MY CODE:

self.newPostAddedInWallHandel = FIRDatabase.database().reference().child("wall").child(self.myuserid
        ).observe(.childAdded, with: { (snapshot) in

            debugPrint(snapshot)
            debugPrint(snapshot.key)
}

Whenever the new post is created , post id is added to wall node and I get the correct snapshot. I've the observer for wall node .childAdded.

NOTE: Everything works fine but when I re-run app. .childAdded observer is called for all the posts in the firebase.

What am I missing here ? Couldn't figure this out ? I don't think .childAdded should be calling again on re-launching the app. Any Suggestions.

user3804063
  • 809
  • 1
  • 14
  • 32
  • Put your code in your question, plz! – javimuu Feb 15 '17 at 01:41
  • @DuyMuu please check how come .childAdded is called with all the values in the server. – user3804063 Feb 15 '17 at 01:46
  • Possibly a duplicate of [this](http://stackoverflow.com/questions/18270995/how-to-retrieve-only-new-data), [this](http://stackoverflow.com/questions/39584091/firebase-observe-with-type-childadded-retrieves-all-my-information-every-time?rq=1) or [this](http://stackoverflow.com/questions/19883736/how-to-discard-initial-data-in-a-firebase-db?noredirect=1&lq=1) – johnozbay Feb 15 '17 at 02:11
  • @canozbay thanks man thanks a lot – user3804063 Feb 15 '17 at 02:37
  • @user3804063 you're very welcome. – johnozbay Feb 15 '17 at 02:40

0 Answers0