firebase-ios-sdk: Path .info/connected returns NO with good connection

Step 0: Are you in the right place?

  • For issues or feature requests related to the code in this repository file a Github issue.
    • If this is a feature request please use the Feature Request template.
  • For general technical questions, post a question on StackOverflow with the firebase tag.
  • For general (non-iOS) Firebase discussion, use the firebase-talk google group.
  • For backend issues, console issues, and other non-SDK help that does not fall under one of the above categories, reach out to Firebase Support.
  • Once you’ve read this section and determined that your issue is appropriate for this repository, please delete this section.

[REQUIRED] Step 1: Describe your environment

  • Xcode version: 11.3
  • Firebase SDK version: 6.16.0
  • Firebase Component: Database
  • Component version: 6.1.4
  • Installation method: CocoaPods (select one)

[REQUIRED] Step 2: Describe the problem

Steps to reproduce:

What happened? How can we make the problem occur? We use the .info/connected to make sure Firebase is online but it quite often returns NO even when the phone internet connection is working fine and without any issues. Not sure if its a bug, a mistake in our implementation or if thats normal to happen.

If you have a downloadable sample project that reproduces the bug you’re reporting, you will likely receive a faster response on your issue.

Relevant Code:

Database.database().reference(withPath: ".info/connected").observe(.value)
        {[weak self] (snapshot) in
            
            if let unwrappedIsConnected = snapshot.value as? Bool {
                
                if(unwrappedIsConnected){
                    
                    SwiftMessages.hide(id: "messageCantReachServer")
                    
                    if let unwrappedTask = self?.task {
                        
                        unwrappedTask.cancel()
                    }
                } else {
            
                    self?.task = DispatchWorkItem { self?.showMessageCantReachServer() }
                    
                    if let unwrappedTask = self?.task {
                        
                        DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + 3, execute: unwrappedTask)
                    }
                }
            }
        }

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 19 (10 by maintainers)

Most upvoted comments

Thats a common report from our users so it happens in many different networks. Also we have seem it happens simultaneously in 4 different devices and each using their own cellular data and not the same network.

I will try to see what I can get from the console messages and send it here.

@brurend You may either send the logs to my email mmaksym@google.com or create a Firebase Support case mentioning the GitHub issue and my GitHub username, so the support team can forward the minimal required information to me. Independently on the option you prefer, I would encourage you to remove any private information unrelated to the issue from the logs. For the beginning, we will need only logs with [Firebase/Database] tag. Thanks!

Do you have duplicate class definition warnings in your app’s runtime?

I had both -FIRDebugEnabled (ON) and -FIRDebugDisabled (OFF) there, I removed the disabled and now I’m seeing Database logs, I will see what I can find to send here when the error happens.

But I’m still getting the warnings I mentioned in my last reply about FirebaseApp.configure()