I was wondering how how exactly Parse loads PFFile
data when you use getData()
or any of its background equivalents. Here's my case:
I have a User
class with a key profilePic
, which is a PFFile
, in this case a .JPG image. When I load my user I want to display his profile picture into a UIImageView
. Here's the code I use:
let imageFile = user["profilePic"] as PFFile
let imageData = imageFile.getData()
let image = UIImage(data: imageData)
I then proceed to set the image
to the UIImageView
in a UITableViewCell
.
As you can see I'm using getData()
instead of getDataInBackgroundWithBlock()
, where I would set the image
in the completion block.
The thing is, I get a warning that I am blocking the main thread, but I notice absolutely no lag whatsoever when I scroll through my table rapidly, thus triggering getData()
often. I also see no network indicator in the status bar, which would indicate it's pulling the image file from Parse repeatedly.
In summary my question is this: how exactly does parse load my image file when it loads the user? Does it download the image file when it gets all the user info and store it in the cache? Or does it just load the reference to the file, after which it downloads the file whenever I call getData()
?
Thanks in advance.