ios - How to check if UIWebView loads from NSURLCache? -
i have more 1 question regarding this... i'm still new nsurlcache , uiwebviews somehow got basics down think.
anyway, able implement caching uiwebview(i think). initialized nsurlcache. uiwebview loads contents loadrequest: method. assigned viewcontroller owns uiwebview it's delegate. had viewcontroller implement nsurlconnectiondatadelegate. implemented connection:willcacheresponse: method log message in console check caching done. logged current disk , memory usage. increases after caching can see did work.
however, when load page again, think request sent again server because connection delegate methods connection:didreceiveresponse: , connection:willcacheresponse being called.
i wanted try getting cachedresponse cache using cachedresponseforrequest:. called method in webviewdidfinishload: returns null. did caching work?
how can tell if webview loaded cache? misusing cachedresponseforrequest:? , on note, proper control-cache header values should present in least caching? i'm testing on google's homepage url , returns private value cache control header can see caching works because connection:willcacheresponse: called.
help please?
if run http proxy charles or fiddler can keep tabs on network traffic going out on wire(less).
you can inspect request/response headers see whether response indeed destined cache.
note in cases might see conditional-get (returns 304) meaning client asked content has in cache, wants download content if server has more recent version.
Comments
Post a Comment