//清除UIWebView的缓存
[ [NSURLCache sharedURLCache ]removeAllCachedResponses];
附:NSUrlcache的公有方法
- (void)removeCachedResponseForRequest:(NSURLRequest *)request;
- (void)removeAllCachedResponses;
获取当前缓存大小:
/*!
@method currentMemoryUsage
@abstract Returns the current amount of space consumed by the
in-memory cache of the receiver.
@discussion This size, measured in bytes, indicates the current
usage of the in-memory cache.
@result the current usage of the in-memory cache of the receiver.
*/
- (NSUInteger)currentMemoryUsage;
/*!
@method currentDiskUsage
@abstract Returns the current amount of space consumed by the
on-disk cache of the receiver.
@discussion This size, measured in bytes, indicates the current
usage of the on-disk cache.
@result the current usage of the on-disk cache of the receiver.
*/
- (NSUInteger)currentDiskUsage;
清除UIWebView缓存与NSUrlCache使用
本文介绍如何清除iOS应用中UIWebView的缓存,并提供了清除缓存的具体代码实现。此外,还介绍了NSUrlCache的公有方法,包括如何移除特定请求的缓存响应以及如何获取当前内存和磁盘缓存的大小。
2444

被折叠的 条评论
为什么被折叠?



