On iOS where is the NSURLCache cache stored if diskPath:nil?

ios, nsurlcache

Solution

I had some free time today to do some testing and found the answer. Nothing exciting but if you are curious:

By default iOS will use a database named Cache.db and, as @qegal mentioned, will be stored under the default location.

Problem

I've come across code that looks like this: ``` NSURLCache *URLCache = [[NSURLCache alloc] initWithMemoryCapacity:1024 * 1024 diskCapacity:1024 * 1024 * 5 diskPath:nil]; ``` The problem is that I haven't been able to find what's the expected behavior when diskPath is passed nil. NSURLCache docs don't explicitly describe this situation nor I have been able to figure it out with my own testing. Where is the cache stored? or is that code above a bug? Thanks.

Original source