I've been trying to figure this out for the past hour and after endless searching can't seem to see the issue. I'm new to Objective-C development and have recently taken on a new codebase to use as a learning tool.
I'm trying to set an image to a cell which has a placeholder image and upon a completed request, sets the image to the bounds of the cell. However the code is failing because of the following error:
Incompatible block pointer types sending 'void (^)(UIImage *__strong, NSError *__strong, SDImageCacheType)'
Upon searching SO and other sources all I can find is ensuring that void is indeed returned. You can see from the code below that nothing is returned, thus it is void.
if(imageURL != nil)
{
cell.productImageView.contentMode = UIViewContentModeCenter;
__weak typeof(cell) weakCell = cell;
[cell.productImageView sd_setImageWithURL:imageURL placeholderImage:[UIImage sd_animatedGIFNamed:@"loading-indicator"] completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, BOOL finished) {
if (image)
{
[weakCell.productImageView setContentMode:UIViewContentModeScaleAspectFill];
}
}];
}
Here is the header code for that particular item:
- (void)sd_setImageWithURL:(NSURL *)url placeholderImage:(UIImage *)placeholder completed:(SDWebImageCompletionBlock)completedBlock;
Thanks in advance!