不兼容的块指针类型SDWebImage

时间:2013-03-18 18:25:33

标签: ios objective-c sdwebimage

我检查了一些这方面的答案,但这是我的代码特有的,我无法让它工作。有什么想法吗?

错误从

开始
completed:^(UIImage *image, NSError *...

完整代码

//Load from URL
        NSURL *url =[NSURL URLWithString:image.imageURL];


        SDWebImageManager *manager = [SDWebImageManager sharedManager];

        [manager downloadWithURL:url
                         options:0
                        progress:^(NSUInteger receivedSize, long long expectedSize)
         {
             // progression tracking code
         }
                       completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType)
         {
             if (image)
             {
                 // do something with image
             }
         }];

1 个答案:

答案 0 :(得分:3)

SDWebImageManager标题中,该方法声明为:

- (id<SDWebImageOperation>)downloadWithURL:(NSURL *)url
                                   options:(SDWebImageOptions)options
                                  progress:(SDWebImageDownloaderProgressBlock)progressBlock
                                 completed:(SDWebImageCompletedWithFinishedBlock)completedBlock;

SDWebImageCompetedWithFinishedBlock的声明如下:

typedef void(^SDWebImageCompletedWithFinishedBlock)(UIImage *image, NSError *error, SDImageCacheType cacheType, BOOL finished);

所以看起来你错过了finished BOOL