WKWebView internet cache seems weak

So we are messing w/ the new WKWebView, and remote caching of images (e.g. let's say loaded from an Amazon S3 bucket)

seems to be very weak. It seems like less than 5% of image data pulls are cached. So they are continually being downloaded

from the network, causing huge network traffic as we run our app. Nomatter what settings we use to try to increase the cache size, results seem the same.


You can see this if you go into Safari Developer mode and monitor network traffic. The "Cached" column is mosty NO.


I put a link to a snapshot from the network http traffic analyzer in safari dev


http://diffent.com/cacheStatusWK.jpg


you see most of the files are about the same size but few are cached...and this is a page

that had at least some items cached


this is after running the app for a while


we tried setting NSURLCache, but it seems to have no effect in WKWebVIew, nomatter how large we make it


NSURLCache* sharedCache = [[NSURLCache alloc] initWithMemoryCapacity:cacheSizeMemory diskCapacity:cacheSizeDisk diskPath:@"nsurlcache"];

[NSURLCache setSharedURLCache:sharedCache];


clues to fix? wait for ios10?

Put this code in the webViewDidFinish

Code Block Swift
var request = URLRequest(url: URL(String: "Your URL Here")
request.cachePolicy = .(Something)


This will cache the url
WKWebView internet cache seems weak
 
 
Q