title: Display Image From Parse In Swift
body: <p>I am trying to display the image I have stored in Buddy For Parse into a UIImageView, however I keep getting this error:</p>
  
  <blockquote>
    <p>Could not cast value of type 'PFFileObject' (0x1045e0568) to 'NSString' (0x1041d75d8).
    2019-04-13 18:15:09.869460-0500 PerfectLaptop[43839:3094232] Could not cast value of type 'PFFileObject' (0x1045e0568) to 'NSString' (0x1041d75d8).</p>
  </blockquote>
  
  <p>I have already stored numerous strings into Parse, and am able to access them with no problems, and have stored the image I wanted to use also, however no matter what I try, I can't seem to get it to work. Many of the solutions I have found include casting the object as a <code>PFFile</code>, however this doesn't seem to exist anymore.</p>
  
  <pre><code>let query = PFQuery(className: "whichOneRecommended")
  query.findObjectsInBackground { (objects, error) in
      if error == nil
      {
          if let returnedobjects = objects
          {
              for object in returnedobjects
              {
  
                  if (object["whichOne"] as! String).contains("\(self.whichOneJoined)")
                  {
                      self.laptopImage.image = UIImage(named: (object["laptopImage"]) as! String)
  
  
  
                  }
              }
          }
      }
  }
  </code></pre>
  
  <p>While the image file is viewable and downloadable in parse, I can't seem to actually have it be displayed in the <code>imageview</code>, and i want the image view to change programmatically by running this function as I have with other parts of the object.</p>
  
  <p>Thanks in advance</p>