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.
sdwebimage calls
cleandisk
upon receivinguiapplicationwillterminatenotification
. 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, defaults604800
seconds (1 week).do have calls sdwebimage's
cleardisk
orclearmemory
methods in app? if so, set breakpoints on them find why they're called during resume.- 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
Post a Comment