我AFImageRequestOperation
用来从我的服务器下载数百个 jpg。
NSURLRequest *request = [NSURLRequest requestWithURL:theURL cachePolicy:NSURLCacheStorageNotAllowed timeoutInterval:20];
AFImageRequestOperation *operation;
operation = [AFImageRequestOperation imageRequestOperationWithRequest:request
imageProcessingBlock:nil
success:^(NSURLRequest *request, NSHTTPURLResponse *response, UIImage *image) {}
failure:^(NSURLRequest *request, NSHTTPURLResponse *response, NSError *error) {}
];
operation.outputStream = [NSOutputStream outputStreamToFileAtPath:[[paths objectAtIndex:0] stringByAppendingPathComponent:picture] append:NO];
[downloadQueue addOperation:operation];
如果我将它们全部删除(删除文档文件夹中的所有图像)并再次开始下载,则会立即处理第一个 X(取决于我在上次下载过程中获得的距离)操作。似乎从前一个过程下载的图像存储(缓存)在某处。我还检查了模拟器的文档文件夹,并且图像已正确下载。那么如何确保下载过程真正从头开始呢?