title: Error when connecting to firebase/firestore: Could not reach Cloud Firestore backend
body: <p>I am developing an app in swift and using Firestore to store my data. It’s the first time that I am using Firebase. </p>
  
  <p>Yesterday I connected the <code>firebase</code> and <code>firestore</code> to my project and everything worked fine. Today suddenly I got an error that It could not connect to the Firestore backend.</p>
  
  <blockquote>
    <p>2020-04-03 13:37:25.851931+0200 Bouwresten[14277:2448929] 6.21.0 - [Firebase/Firestore][I-FST000001] Could not reach Cloud Firestore backend. Connection failed 1 time. Most recent error: Network connectivity changed This typically indicates that your device does not have a healthy Internet connection at the moment. The client will operate in offline mode until it is able to successfully connect to the backend.</p>
  </blockquote>
  
  <p>Now I know for sure that my computer has a good connection and I am using the simulator of Xcode to test the app. Does anyone know what the problem could be?</p>
  
  <p>This is my appdelegate.swift</p>
  
  <pre><code>//
  //  AppDelegate.swift
  //  Bouwresten
  //
  //  Created by Brecht Verhelst on 25/03/2020.
  //  Copyright © 2020 Brecht Verhelst. All rights reserved.
  //
  
  import UIKit
  import Firebase
  import FirebaseFirestore
  
  @UIApplicationMain
  class AppDelegate: UIResponder, UIApplicationDelegate {
  
      func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -&gt; Bool {
          // Override point for customization after application launch.
          FirebaseApp.configure()
          return true
      }
  
      // MARK: UISceneSession Lifecycle
  
      func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -&gt; UISceneConfiguration {
          // Called when a new scene session is being created.
          // Use this method to select a configuration to create the new scene with.
          return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role)
      }
  
      func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set&lt;UISceneSession&gt;) {
          // Called when the user discards a scene session.
          // If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions.
          // Use this method to release any resources that were specific to the discarded scenes, as they will not return.
      }
  
  
  }
  </code></pre>
  
  <p>This is the class where I use the firestore to get data, it's called dbhelper</p>
  
  <pre><code>//
  //  DBHelper.swift
  //  Bouwresten
  //
  //  Created by Brecht Verhelst on 02/04/2020.
  //  Copyright © 2020 Brecht Verhelst. All rights reserved.
  //
  
  import Foundation
  import Firebase
  import FirebaseFirestore
  
  class DBHelper
  {
      var Users = [User]()
      var Products = [Product]()
      init() {
          getUsers()
      }
  
      func getUsers()  {
          Firestore.firestore().collection("Gebruikers").getDocuments() { (querySnapshot, err) in
              if let err = err {
                  print("Error getting documents: \(err)")
              } else {
                  for document in querySnapshot!.documents {
                      let user:User = User(Voornaam: document.get("Naam") as! String, Familienaam: document.get("Familienaam") as! String, Email: document.get("Email") as! String, Wachtwoord: document.get("Wachtwoord") as! String,
                                           Stad: document.get("Stad") as! String, Postcode: document.get("Postcode") as! String, Straat: document.get("Straat") as! String, Nummer: document.get("Nummer") as! String, Added_on: document.get("Added_on") as! String)
                      self.Users.append(user)
                      print(self.Users.count)
                  }
              }
          }
      }
  
      func getProducts()  {
          Firestore.firestore().collection("Producten").getDocuments() { (querySnapshot, err) in
              if let err = err {
                  print("Error getting documents: \(err)")
              } else {
                  for document in querySnapshot!.documents {
                      let product:Product = Product(Titel: document.get("Titel") as! String, Beschrijving: document.get("Beschrijving") as! String, Prijs: document.get("Prijs") as! Double, Gereserveerd: document.get("Gereserveerd") as! Bool, Added_on: document.get("Added_on") as! String, Gebruiker_id: document.get("gebruiker_ID") as! String)
                      self.Products.append(product)
                  }
              }
          }
          print(self.Products.count)
      }
  }
  </code></pre>
  
  <p>Hope someone can help me with this problem.</p>