In mine ProfileViewController, I have a request that retrieves a user profile image that 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 request in this view, I have another request on my home page of my application, in which there are all messages of all users. The error I get is s. A long-running operation is being executed on the main thread.Next followsBreak on warnBlockingOperationOnMainThread() to debug.
I donβt know how to get around this, because I need to make another request in order to get the current publication of users for this profile. Should I use something other than findObjectsInBackgroundWithBlock. Thank you
source
share