title: Can't access Firebase child
body: <p>I have a firebase database reference</p>
  
  <pre><code>FIRDatabase.database().reference().child("messages").child("\(self.convoId!)").childByAutoId()
  </code></pre>
  
  <p>I want to access the ReceiverName from my firebase database in DisplayViewController, but when I call the database reference, I get an error because of convoId. This is how convoId was declared (in MessagesViewController).</p>
  
  <pre><code> override func viewDidLoad() {
          super.viewDidLoad()
    let receiverId = receiverData as! String
          let receiverIdFive = String(receiverId.characters.prefix(5))
          let senderIdFive = String(senderId.characters.prefix(5))
          if (senderIdFive &gt; receiverIdFive)
          {
              self.convoId = senderIdFive + receiverIdFive
          }
          else
          {
              self.convoId = receiverIdFive + senderIdFive
  }
      }
  </code></pre>
  
  <p>receiverData was passed from UserviewController to MessagesViewController and "senderId" is the string identifier that uniquely identifies the current user sending messages and is automatically declared in JSQMessagesViewController.h. so essentially, I can't redeclare convoId in my DisplayViewController. However, in DisplayViewController, I need to access ReceiverName.</p>
  
  <p>This is how I attempted to retrieve ReceiverName:</p>
  
  <pre><code>let rootRef = FIRDatabase.database().reference()        
  rootRef.child("messages").observeSingleEvent(of: .value) { 
      (snapshot: FIRDataSnapshot) in
      let loggedInUserData = snapshot
      if let postsDictionary = snapshot .value as? [String: AnyObject] {
          for post in postsDictionary {
              self.messages.add(post.value)
          }
          self.MessageTableView.reloadData()
      }
  }
  </code></pre>
  
  <p>Then I populate the derived data in a tableviewcell:</p>
  
  <pre><code>override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -&gt; UITableViewCell {
      let cell = tableView.dequeueReusableCell(withIdentifier: "MessageCell", for: indexPath) as! MessageTableViewCell
  
  
      //Configure the cell
  
  
      print(messages[indexPath.row])
      let message = self.messages[indexPath.row] as! [String: AnyObject]
      cell.SellerName.text = message["ReceiverName"] as? String
  
         return cell
  }
  </code></pre>