问题
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