我如何找出UIImage是否已经使用NSURLConnection进行缓存?
示例:
if([NSURLCache containsObject:[UIImage imageNamed@"testPic.png"]]){
NSLog(@"item already cached!");
}
显然上面的代码不起作用,但你明白了......
谢谢!
答案 0 :(得分:0)
您必须保存请求的副本,然后再询问sharedCache:
- (NSCachedURLResponse *)cachedResponseForRequest:(NSURLRequest *)request
返回的对象中包含大量内容,包括数据对象。