I am trying to configure NSURLCache with the maximum disc capacity possible. I'm on iOS 7.
according to the docs, NSURLCache's discCapacity attribute is a NSUInteger, aka unsigned int, which should accept a maximum value of 4,294,967,295 (0xFFFFFFFF). However, using any value above 0x7FFFFFFF (2147483647) results in the value actually reporting itself as 0 and the disc cache isn't working at all.
Furthermore, using 0x7FFFFFFF (2GB), actually results in malloc errors as soon as the disc cache fills up anywhere close to the 2GB.
The only way i found this working is with a maximum value of 1GB (1073741824). When using this value, all works as expected.
I would like to use NSURLCache with as much disc capacity as possible for my application. How can i use 8 or even 16GB?
Update [adding code example as requested in comments]:
NSURLCache* sharedCache = [[NSURLCache alloc] initWithMemoryCapacity:sizeInBytes
diskCapacity:sizeInBytes
diskPath:@"somepath"];
[NSURLCache setSharedURLCache:sharedCache];
or you can also do:
[[NSURLCache sharedURLCache] setDiskCapacity:sizeInBytes];
[[NSURLCache sharedURLCache] setMemoryCapacity:sizeInBytes];