我有一个类 URLCache 扩展 NSURLCache
在 URLCache.m
+ (void)initialize {
NSString *_cacheSubFolder = nil;
NSUInteger _cleanCacheFilesInterval;
if (_pageType == FirstPage) {
_cleanCacheFilesInterval = FirstPageCleanCacheFilesInterval;
_cacheSubFolder = @"/WebCatchedFiles/FirstPage/";
}else if (_pageType == SecondPage){
_cleanCacheFilesInterval = SecondPageCleanCacheFilesInterval;
_cacheSubFolder = @"/WebCatchedFiles/SecondPage/";
}else if (_pageType == ThirdPage){
_cleanCacheFilesInterval = ThirdPageCleanCacheFilesInterval;
_cacheSubFolder = @"/WebCatchedFiles/ThirdPage/";
}
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES);
cacheDirectory = [[paths objectAtIndex:0] stringByAppendingString:_cacheSubFolder];
// cacheDirectory = [cacheDirectory stringByAppendingString:@"/"];
removeFilesInCacheInDueTime(cacheDirectory, _cleanCacheFilesInterval);
createDirectry(cacheDirectory);
supportSchemes = [NSSet setWithObjects:@"http", @"https", @"ftp", nil];
}
如果 Am 调用 URLCache.m 那么 A 需要将参数 _pageType 发送到 URLCache,我不知道如何发送 _pageType。我试过了
-(void)setPageType:(NSUInteger)pageType{
_pageType = pageType;
}
但每次在上午
URLCache *sharedCache = (URLCache *)[NSURLCache sharedURLCache];
[sharedCache setPageType:self.naviType];
得到
由于未捕获的异常“NSInvalidArgumentException”而终止应用程序,原因:“-[NSURLCache setPageType:]:无法识别的选择器发送到实例 0xabd1470”
为什么不能将参数发送到 NSURLCache?
如何发送_pageType?