Incompatible block pointer types SDWebImage

◇◆丶佛笑我妖孽 提交于 2019-12-08 04:57:25

问题


I checked some answers on this, but this is specific to my code, and I cannot get this to work. Any thoughts?

Error starts at

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

Full code

//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:


From the SDWebImageManager header, the method is declared as:

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

SDWebImageCompetedWithFinishedBlock is declared like so:

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

So it looks like you're missing the finished BOOL



来源:https://stackoverflow.com/questions/15484136/incompatible-block-pointer-types-sdwebimage

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!