title: Firebase Database connection was forcefully killed by the server. Will not attempt reconnect. Reason: Firebase error. (Swift iOS)
body: <p>This is a block of code I'm using in my Xcode project. I'm trying to access data from my firestore database, however this block of code keeps on bringing up the error:</p>
  <blockquote>
  <p>Firebase Database connection was forcefully killed by the server.  Will not attempt reconnect. Reason: Firebase error. Please ensure that you spelled the name of your Firebase correctly</p>
  </blockquote>
  <p>It's only this block of code that brings up the error. When I delete it, it's fine and the error goes away (but obviously the code won't be executed), and I really have no idea how to fix it.</p>
  <pre><code>Database.database().reference().child(&quot;cPosts&quot;).observe(.value)
    { (snapshot) in
        if let snapshot = snapshot.children.allObjects as? [DataSnapshot]
        {
            for data in snapshot
            {
                self.posts.removeAll()
                print(data)
                if let postDict = data.value as? Dictionary&lt;String, AnyObject&gt;
                {
                    let key = data.key
                    let post = CompPost(postKey: key, postData: postDict)
                    self.posts.removeAll()
                    self.posts.append(post)
                }
            }
        }
        
        self.tableView.reloadData()
  </code></pre>