title: Swift Could Not Cast Value of Type __NSInlineData to PFFile
body: <p>I am trying to display my Parse users image in a tableview cell and I run into an error when I try to pull the image</p>
  
  <pre><code>Could not cast value of type '_NSInlineData' (0x1086e9cf8) to 'PFFile' (0x106b2ee80)
  </code></pre>
  
  <p>I'm trying to figure out whether this is a result of how I'm trying to get the data or the format that the image file is saved in.</p>
  
  <p>Here is how the image is being saved,</p>
  
  <p>UserRegistrationViewController.swift:</p>
  
  <pre><code>import UIKit
  
  class UserRegistrationViewController: UIViewController {
  
  
      func displayAlert(title:String, error:String) {
  
          var alert = UIAlertController(title: title, message: error, preferredStyle: UIAlertControllerStyle.Alert)
  
          alert.addAction(UIAlertAction(title: "OK", style: .Default, handler: {
              action in
  
  
  
          }))
  
          self.presentViewController(alert, animated: true, completion: nil)
  
  
      }
  
      @IBOutlet var usernameTextField: UITextField!
  
      @IBOutlet var emailTextField: UITextField!
  
      @IBOutlet var passwordTextField: UITextField!
  
      @IBOutlet var profileImage: UIImageView!
  
      override func viewDidLoad() {
          super.viewDidLoad()
  
          var user = PFUser.currentUser()
  
          var FBSession = PFFacebookUtils.session()
  
          var accessToken = FBSession.accessTokenData.accessToken
  
          let url = NSURL(string: "https://graph.facebook.com/me/picture?type=large&amp;return_ssl_resources=1&amp;access_token="+accessToken)
  
          let urlRequest = NSURLRequest(URL: url!)
  
          NSURLConnection.sendAsynchronousRequest(urlRequest, queue: NSOperationQueue.mainQueue(), completionHandler: {
                  response, data, error in
  
                  let image = UIImage(data: data)
  
                  self.profileImage.image = image
  
  
                  user["image"] = data
  
                  user.saveInBackground()
          })
  
          FBRequestConnection.startForMeWithCompletionHandler({
              connection, result, error in
  
              user["name"] = result["name"]
  
              user.saveInBackground()
  
              println(result)
  
          })
      }
  
      override func didReceiveMemoryWarning() {
          super.didReceiveMemoryWarning()
          // Dispose of any resources that can be recreated.
      }
  
  
      @IBAction func registerUser(sender: AnyObject) {
  
          var error = ""
  
          if usernameTextField.text == nil || emailTextField.text == nil || passwordTextField.text == nil {
  
              error = "Please enter a username, email and password"
  
          }
  
  
          if error != "" {
  
              displayAlert("Error In Form", error: error)
  
          } else {
  
              var user = PFUser.currentUser()
  
              user.username = usernameTextField.text
              user.password = passwordTextField.text
              user.email = emailTextField.text
  
  
  
              user.saveInBackgroundWithBlock {
                  (succeeded: Bool, signupError: NSError!) -&gt; Void in
                  if signupError == nil {
  
                      println(user.username)
                      println(user.password)
                      println(user.email)
  
  
                      self.performSegueWithIdentifier("successfulRegistration", sender: self)
  
                      /*self.navigationController?.setNavigationBarHidden(self.navigationController?.navigationBarHidden == false, animated: true)*/
  
                  } else {
  
                      if let errorString = signupError.userInfo?["error"] as? NSString {
                          error = errorString as String
                      } else {
  
                          error = "Please try again later."
  
                      }
  
  
                      self.displayAlert("Could Not Sign Up", error: error)
  
                  }
              }
  
  
          }
  
  
      }
  
  }
  </code></pre>
  
  <p>Here is how I am trying to pull and display the data:</p>
  
  <pre><code>import UIKit
  
  class SearchUsersRegistrationViewController: UIViewController, UITableViewDelegate, UITableViewDataSource {
  
  
      var userArray : NSMutableArray = []
  
  
      @IBOutlet var tableView: UITableView!
  
      override func viewDidLoad() {
          super.viewDidLoad()
  
          tableView.delegate = self
          tableView.dataSource = self
  
          loadParseData()
  
          var user = PFUser.currentUser()
  
  
      }
  
      override func didReceiveMemoryWarning() {
          super.didReceiveMemoryWarning()
          // Dispose of any resources that can be recreated.
      }
  
  
      func loadParseData() {
  
          var query : PFQuery = PFUser.query()
  
          query.findObjectsInBackgroundWithBlock {
              (objects:[AnyObject]!, error:NSError!) -&gt; Void in
  
              if error == nil {
  
                  if let objects = objects {
  
                      println("\(objects.count) users are listed")
  
                      for object in objects {
  
                          self.userArray.addObject(object)
  
                      }
                      self.tableView.reloadData()
                  }
              } else {
                  println("There is an error")
              }
          }
      }
  
  
  
      let textCellIdentifier = "Cell"
  
      func numberOfSectionsInTableView(tableView: UITableView) -&gt; Int {
  
          return 1
  
      }
  
      func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -&gt; Int {
          return self.userArray.count
      }
  
      func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -&gt; UITableViewCell {
  
          let cell = tableView.dequeueReusableCellWithIdentifier(textCellIdentifier, forIndexPath: indexPath) as! SearchUsersRegistrationTableViewCell
  
          let row = indexPath.row
  
          var individualUser = userArray[row] as! PFUser
          var username = individualUser.username as String
  
          var profilePicture = individualUser["image"] as! PFFile
  
          profilePicture.getDataInBackgroundWithBlock({
              (result, error) in
  
              cell.userImage.image = UIImage(data: result)
  
  
  
          })
  
  
          cell.usernameLabel.text = username
  
          return cell
      }
  
      @IBAction func finishAddingUsers(sender: AnyObject) {
          self.performSegueWithIdentifier("finishAddingUsers", sender: self)
  
      }
  
  }
  </code></pre>