title: Only show friends posts on Parse
body: <p>new programmer trying to learn Swift and I'm trying to set my app up to only show the current users post on a parse photosharing database. The first method here in theory should add the current user to the "followingWho" array. </p>
  
  <pre><code>override func viewDidLoad() {
      super.viewDidLoad()
  
      let userQuery = PFUser.query()
      userQuery?.whereKey("username", equalTo: PFUser.currentUser()!.username!)
      userQuery?.findObjectsInBackgroundWithBlock ({
          (objects: [PFObject]?, error: NSError?) -&gt; Void in
  
  
          if error == nil {
              //no error
              if let objects = objects {
                  for object in objects {
                      let followingWho = object["followingWho"] as! NSArray!
                      self.loadData(followingWho)
                  }
              }
  
          } else {
              //error 
              NSLog("Error")
          }
      })
  
  
      self.tableView.reloadData()
  </code></pre>
  
  <p>}</p>
  
  <p>then my second method here should display the posts and filter out all but the current users</p>
  
  <pre><code>func loadData(followingWho: NSArray) {
  
      let query = PFQuery(className: "Posts")
      query.whereKey("addedBy", containedIn: followingWho as! [PFObject])
      query.orderByDescending("createdAt")
      query.findObjectsInBackgroundWithBlock {
          (posts: [PFObject]?, error: NSError?)  -&gt; Void in
  
  
          if (error == nil) {
              //No error
  
              //let posts = posts as! [PFObject]
  
              if let posts = posts {
                  for post in posts {
                      self.images.append(post["Image"] as! PFFile)
                      self.imageCaptions.append(post["Caption"] as! String)
                      self.imageDates.append(post["date"] as! String)
                      self.imageUsers.append(post["addedby"] as! String)
                  }
  
                  self.tableView.reloadData()
              }
  
          } else {
              //error
              NSLog("Error")
          }
  
      }
  
  }
  </code></pre>
  
  <p>But nothing seems to be working. The code compiles and runs but it seems to only pull up a blank screen loading none of the posts.</p>