我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];
如果我现在想取消正在进行的下载,我执行[downloadQueue cancelAllOperations]
.
使用我使用的以前版本的 AFNetworking(今年早些时候),这非常有效,但使用最近的版本,我得到了这个:
ERROR [http://myImageURL] -- The operation couldn’t be completed. (NSURLErrorDomain error -999.)
对于所有待处理的操作。我现在需要做一些额外的事情吗?