title: With Firebase, Swift removeObserver(withHandle does not remove the observer
body: <p>With removeObserver(withHandle in Swift 3, the Observer is not removed on viewDidDisappear </p>
  
  <pre><code>var query = FIRDatabaseQuery()
  
  var postRef: FIRDatabaseReference!
  var postRefHandle: FIRDatabaseHandle?
  
  override func viewDidLoad() {
      super.viewDidLoad()
  
      postRef = baseRef.child("Posts")
  }
  
  override func viewDidDisappear(_ animated: Bool) {
      super.viewDidDisappear(animated)
  
      if postRefHandle != nil {
          //try 1:
          //postRef.removeObserver(withHandle: postRefHandle!)
  
          //try 2:
          //postRef.queryOrdered(byChild: "sortTimestamp").removeObserver(withHandle: postRefHandle!)
  
          //try 3: 
          //query.removeObserver(withHandle: postRefHandle!)
      }
      //try 4:
      //postRef.removeAllObservers() //works
  }
  
  func getPosts()
  {
      var count = 20 
  
      query = postRef.queryOrdered(byChild: "sortTimestamp")
  
      postRefHandle = query.queryLimited(toFirst: UInt(count)).observe(.childAdded //etc.
  }
  </code></pre>
  
  <p>So I tried the three methods in viewDidDisappear, but the observer is not removed. 
  try 3 query.removeObserver(withHandle: postRefHandle!) as by answer from <a href="https://stackoverflow.com/questions/40346533/firebase-how-do-i-return-a-handle-so-that-i-can-call-removeobserver">Firebase, how do I return a handle so that I can call removeObserver?</a> by frank-van-puffelen</p>
  
  <p>The only one that does work is the one outlined in try 4. 
  Any reason why I cannot remove the Observer with removeObserver(withHandle? (try 1 - 3)</p>
  
  <p>Also "query.queryLimited(toFirst: UInt(count)).observe(.childAdded"  does not get the latest data from Firebase. I was under the impression the observe always gets the updated data, as opposed to observeSingleEvent. Why does it not do that?</p>
  
  <p>Any suggestions are much appreciated.</p>