0

So, I have several user on my pfuser and each user have profile picture. And everytime user enter my app feed page, my app download the user profile picture.

I have no problem caching query but I have problem to cache direct pfuser file, like below code:

let userPicture: AnyObject? = PFUser.currentUser()?["profilePicture"] as? PFFile

userPicture?.cachePolicy = PFCachePolicy.CacheThenNetwork

I got below warning:

Could not find an overload for 'cachePolicy' that accepts the supplied arguments

How can I cache pffile? do I have to store the image in NSUserDeafaults?

Ega Setya Putra
  • 1,645
  • 6
  • 23
  • 51

1 Answers1

0

PFFile doesn't have a property called cachePolicy.

The thing is you don't have to worry about cache for PFFile because Parse will do it for you by checking the file uuid/url. Once a PFFile has been downloaded, it will be cached and getData will fetch from cache and it will not use up an API request.

Storing images in NSUsersDefaults is a very bad idea and should be discouraged.

JDG
  • 540
  • 1
  • 5
  • 16