我有一个很大的问题,我使用异步下载(1个类)创建一个项目并且完美地工作,现在我将该类复制到另一个项目上,但是当我尝试运行它时,我得到一个exc_bad_access问题就在这一行上
// If have have cached data that is valid for this request, use that and stop
if ([[self downloadCache] canUseCachedDataForRequest:self]) {
[self useDataFromCache];
return;
}
虽然控制台上的错误是
[ASIDownloadCache canUseCachedDataForRequest:]:发送到解除分配的实例0xa99b040的消息
如何解决问题?我不会改变任何东西....只复制我的新项目上的类(并添加相关框架)
编辑:init缓存
ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:url];
ASIDownloadCache *cache = [[ASIDownloadCache alloc] init];
[request setDownloadCache:cache];
[request setCacheStoragePolicy:ASICachePermanentlyCacheStoragePolicy];
[request setCachePolicy:ASIOnlyLoadIfNotCachedCachePolicy];
[cache setStoragePath:@"/Users/kikko/kikko/xxx"];
request.userInfo = [NSDictionary dictionaryWithObjectsAndKeys:
[NSNumber numberWithInt:index], @"index",
url, @"url", nil];
[request setDelegate:self];
[request startAsynchronous];