I have a tabBarController (with in my case 4 tabBarViewControllers). on three of these I have Firebase observers which I load in viewWillAppear and remove in viewDidDisappear(ref.removeAllObservers()).
I add them in the next view, but somehow they don't register for some of the observers (in particular .ChildChanged).
If I move to a modally presented viewController (say settings) and move back, the observer works. If I move from a tabBarViewController, where I remove the observers (in viewDidDisappear) and then add them (in viewWillAppear) in the new tabBarViewController, they do not register.
On top of that if I move completely out of the tabBarController (from a view where I remove the observers completely) to a separate viewController via push segue (in my case to a JSQMessagesViewController), the observers that where present in the tabBarViewController do also not register in the new viewController (which is NOT part of the tabBarViewController).
I have read the piece on Best practices for the iOS UIViewController and Firebase (https://www.firebase.com/blog/2015-10-15-best-practices-uiviewcontroller-ios-firebase.html and the post Firebase: when to call removeObserverWithHandle in swift), but somehow that does not seem to apply to tabBarControllers.
My guess is that a tabBarController with various tabBarViewControllers is somehow seen as a single viewController. And that viewControllers pushed on top of that are seen as part of that single viewController as well (in some instances).
Therefore I would like to know: what are best practices in terms of adding and removing observers in a tabBarViewController?