-[NSURLCache currentDiskUsage] doesn't show actual disk usage (or behavior is not documented).

Originator:s.pankevich
Number:rdar://29181648 Date Originated:09-Nov-2016 05:07 PM
Status:Open Resolved:
Product:iOS Product Version:Xcode 8.1, iPhone 7 Plus Simulator 10.1
Classification:Other Bug Reproducible:Always
 
Area:
Something not on this list

Summary:
The example project in the attached shows that -[NSURLCache currentDiskUsage] does not reflect the actual disk usage that a user of the example app would expect.

In the example app I am storing 20 MB file 3 times and I see that that amount is not reflected when I look at the memory consumption using -currentDiskUsage method.

Steps to Reproduce:
Open the example app and follow the logs.

Expected Results:
I expect currentDiskUsage to reflect the actual disk usage taken by the cached files.

Actual Results:
currentDiskUsage does show me much smaller amounts of disk usage.

Version:
Xcode 8.1, iPhone 7 Plus Simulator 10.1 (14B72).

Notes:
Example project can also be found: https://github.com/stanislaw/Examples/tree/20161109-nsurlcache-weird-behavior-of-currentDiskUsage.

Configuration:
Mac OS 10.11.6

Attachments:
'NSURLCacheDemo.zip' was successfully uploaded.

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!