When I find out the NSURLCache documentation , I cannot find many important notes. I found that many topics on the Internet complain that NSURLConnection that use NSURLCache has memory leaks. When I tried to write some kind of application for iOS 4.3, I found that MSURLCache has weird behavior.
In the appendix: didFinishLaunchingWithOptions: I am installing an NSURLCache instance with a memory capacity of 10 MB, init NSURLRequest with NSURLRequestUseProtocolCachePolicy but I cannot receive the connection: willCacheResponse: message in my delegate NSURLConnection . When I checked the amount of memory at different points in my application, it was 0 MB. What for? Can Apple fix some memory leaks by setting NSURLCache memory to 0? I created my own NSURLCache and redefined the setMemoryCapacity: method as follows:
-(void)setMemoryCapacity:(NSUInteger)memoryCapacity {
if (memoryCapacity > 0) {
[super setMemoryCapacity:memoryCapacity];
}
else {
NSLog(@"zero here");
}
}
. - , URL-. setMemoryCapacity: : , 10 ( ), ( memoryCapacity 0, "zero here" ). connection: willCacheResponse: NSURLConnection.
. , . . ?