0

I'm using very basic caching for a website heavy app I'm making. To set up the cache, all I'm doing is the following:

    NSURLCache.sharedURLCache().memoryCapacity = 300 * MB
    NSURLCache.sharedURLCache().diskCapacity = 300 * MB
    NSURLSession.sharedSession().configuration.requestCachePolicy = .ReturnCacheDataElseLoad

When I'm actually getting data I'm using the following:

let task = NSURLSession.sharedSession().dataTaskWithRequest(request) { (data: NSData?, response: NSURLResponse?, error: NSError?) -> Void in
        if let data = data {
            ...
        }
    }

That is the extent of my networking code. I also save no other data in the app. When I log the current disk usage, I get back 123 MB. Yet, in the storage and usage panel in the settings app, it says my app has 316 MB of data with 293 MB of Documents & Data (the app is 22 MB). It the data being stored twice? Not only is 316 MB over my set limit, but it is more than 2x times the size of the current disk usage.

user2844801
  • 1,394
  • 2
  • 12
  • 20
  • You can use Xcode's Devices window to download the app's container and then inspect the package contents on your computer. – Phillip Mills Aug 13 '15 at 18:53
  • Thanks! In Library/Caches there are two large folders. One is a folder with the name of my bundle ID which shows the 123 MB of storage. The other folder is the WebKit folder, which is 299 MB! Is WebKit caching somewhere that it shouldn't be? – user2844801 Aug 13 '15 at 19:05

0 Answers0