【发布时间】:2012-05-10 11:03:21
【问题描述】:
我使用 AFNetworking 加载 RSS。 看来对 RSS 的 HTTP 请求已成功缓存在磁盘中。 即使在飞行模式下,RSS仍然可以显示。
但是对于RSS中的图片url,我使用UIImageView+AFNetworking分类加载,如果手机处于离线模式,加载失败...为什么?
这就是我初始化 SDURLCache 的方式:
// configure the disk cache here
self.cache = [[SDURLCache alloc] initWithMemoryCapacity:1024*1024 // 1 MB mem cache
diskCapacity:1024*1024*5 // 5 MB disk cache
diskPath:[SDURLCache defaultCachePath]];
self.cache.ignoreMemoryOnlyStoragePolicy = YES;
[NSURLCache setSharedURLCache:self.cache];
这是加载图像的代码。
[self setImageWithURL:[NSURL URLWithString:URL] placeholderImage:[UIImage imageNamed:@"thumbnail_loading.png"]];
【问题讨论】: