uchicago-mobi / MPCS51030-2017-Winter-Forum

7 stars 0 forks source link

Cache images #154

Closed mengwanguc closed 7 years ago

mengwanguc commented 7 years ago

It's told to cache the images using a NSCache. But it seems that every time we run the app, the NSCache will always be empty, and we need to download all the images. Do we need to store the NSCache in Documents Directory, just like what we did for json data?

susanstevens commented 7 years ago

No, don't store it in the Documents directory. The operating system will decide when to clear out NSCache, so it may or may not have the images you saved the previous time you ran the app.

CORRECTION: NSCache won't persist images between app launches. NSCache is similar to a mutable dictionary, except that the system will take care of removing objects from the dictionary if memory is low.

mengwanguc commented 7 years ago

Got it! Thanks!