In my ProfileViewController I have a query that retrieves the users profile picture which is stored as a PF File. 
  var query = PFQuery(className:"Users")
    query.whereKeyExists("profilePicture")
    query.findObjectsInBackgroundWithBlock {
        (objects: [AnyObject]!, error: NSError!) -> Void in
        if error == nil {
            self.userNameLabel.text = PFUser.currentUser().username
            if let imageFile = PFUser.currentUser().objectForKey("profilePicture") as? PFFile {
                if let data = imageFile.getData() {
                    self.profPic.image = UIImage(data: data)
                }
            }
        }
        else {
            println("User has not profile picture")
        }
    }
This is the only query in this view, I have another query in my Home page of my app that has all the posts of all the user. The error I am getting i s A long-running operation is being executed on the main thread. Followed by Break on warnBlockingOperationOnMainThread() to debug.
I don't know how to work around this especially since I need to do another query to get the current users post for there profile. Should I use something other than findObjectsInBackgroundWithBlock. Thanks. 
The warning is from the Parse sdk.  This part: imageFile.getData() is synchronous, and Parse is kind enough to warn you when using any of the blocking calls.  There are a couple varieties of getDataInBackground... available as alternatives.  See them in the docs here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With