ios - Caching images doesnt stay once applicationDidEnterBackground is activated -


i have been having issue no matter framework use cache images, afnetworking sdwebimage's caching techniuqes write disk. everytime press home button, go app. images have re cached.

i have no clue start looking

in order use both afnetworking regular networking functions, such json , image uploading used https://gist.github.com/sibljon/5957892 resolve namespace collisions cold totally override afnetworkings uiimageview , stick sdwebimage instead of calling

thanks jonsibley , his answer dont call

[imagefile setimagewithurl:[nsurl urlwithstring:friendavatar] placeholderimage:[uiimage imagenamed:@"defaultprofileimage.png"]];

im calling (just sd_ in front now) allows me override afnetworkings caching. correct?

[imagefile sd_setimagewithurl:[nsurl urlwithstring:friendavatar] placeholderimage:[uiimage imagenamed:@"defaultprofileimage.png"]];

edit udpate:

after more testing found out app cleaning cache once resumes app, not when starts suspended (when home button pressed) clue may causing this?

here 2 possibilities. please note difference between clea r disk , clea n disk.

  1. sdwebimage calls cleandisk upon receiving uiapplicationwillterminatenotification. method removes files older expiration date. after that, clears files oldest newest until configured maximum cache size reached.

    if aren't setting sdimagecache's maxcachesize property, property ignored.

    if aren't setting sdimagecache's maxcacheage property, defaults 604800 seconds (1 week).

  2. do have calls sdwebimage's cleardisk or clearmemory methods in app? if so, set breakpoints on them find why they're called during resume.

  3. if #1 doesn't explain it, , never call "clear" methods, best bet set breakpoint in [sdimagecache -cleandisk] , step through see why cache getting cleared.

Comments

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -