In Part 1 I discussed how NSURLCache is broken on iOS 8, and delivered some source code in Part 2.
Now that iOS 8.1 has been released (with absolutely no mention in the release notes about this issue, I ran all the tests again, and found that the results were the same as the betas.
- Cache reported size matches actual - PASS. The reported size now includes the SHM and WAL files.
- Clear cache on startup - PASS.
- Cache correctly purged - FLAWED. Sort of - the disk usage sometimes exceeds the maximum size of the cache by a megabyte or two. I believe that the operating system is excluding the size of the WAL file when deciding if the cache is too big or not.
- Cache reads - PASS.
- Cache clears on demand - PASS (but does not delete the WAL, even though that is included in the reported size).
- Clearing cache a second time resets the WAL - PASS (determined by inspecting logs in XCode).
- Can clear individual cache items - FAIL.
As I mentioned, the unlimited growth of the cache might cause problems for people upgrading, because application data would be too large. Sure enough, when one of our employees tried to upgrade to 8.1 last night, they found that Facebook was using over 600MB of data, and Twitter was using over 500MB. The cache problem was well and truly in effect.