我正在尝试使用SDWebImage库下载效率图像。我用串行顺序同时下载10张照片(函数downloadWithURL为每个请求创建一个线程)。有时使用特定网址,功能就像堆叠在无限循环中一样。既不调用成功回调也不调用错误。我知道我使用的不是最新版本的库,但我觉得奇怪的是那里有bug。
我的代码如下:
SDWebImageManager *manager = [SDWebImageManager sharedManager];
[manager downloadWithURL:[NSURL URLWithString:self.imageURL]
delegate:self
options:SDWebImageRetryFailed
success:^(UIImage* image)
{ NSLog(@"downloaded successful"); }
failure:^(NSError* error)
{ NSLog(@"downloaded failure"); }];
答案 0 :(得分:0)
只需在成功方括号中添加BOOL,然后它就会像魅力一样......
SDWebImageManager *manager = [SDWebImageManager sharedManager];
[manager downloadWithURL:[NSURL URLWithString:self.imageURL]
delegate:self
options:SDWebImageRetryFailed
success:^(UIImage* image,BOOL Completed)
{ NSLog(@"downloaded successful"); }
failure:^(NSError* error)
{ NSLog(@"downloaded failure"); }];