I'm developing an iOS app written in Swift 3.0 using Xcode 8.2, which supports iOS 8.0 and higher. App's data is stored in Firebase.
I want to listen to database connection changes (app is connected to Firebase or not).
I'm using FIRDatabaseReference
's function:
func observe(_ eventType: FIRDataEventType, with block: @escaping (FIRDataSnapshot) -> Swift.Void, withCancel cancelBlock: ((Error) -> Swift.Void)? = nil) -> UInt
to observe changes, but this event always returns false (value of 0). At this time (on Firebase Console), Authentication
section related queries are working properly, and Realtime Database
related queries are not.
This happens only on iPod 5.1 (5) with iOS 8.3.
I've tested my application on
- iPad 2 with iOS 8.4.1
- iPod 5.1 (5) with iOS 9.3.5
- iPhone 6 with iOS 10.0.1
too. But on these devices it worked well.
Am I doing something wrong? Is there any issue related to iOS version and Firebase SDK?
Thank you!
SOLVED
I left this issue a little bit behind, and after some time, it reappeared on another device.
I'm not sure, if this solves every similar problem, but I figured out, that my token was expired and I get NO response from database. Which problem was caused by a password change of the same user on another device.
Day 1 - I was logged in with an account on two different devices. I changed my password on one of them.
Day 2 - I tried to download some data from
Realtime Database
section with the other device, but I get NO response, which was really annoying.After 8 hours Firebase Analytics logs on Xcode console finally helped me figure out the problem. I logged out from the problematic device, and then logged in again.
I was wondering why couldn't I get some kind of 'token_expired'-response from the server, or maybe why couldn't I get logged out from the other devices.