My goal is to get the size of the uploaded image through a successful block, as shown below:
[imageView setImageWithURLRequest:[NSURL URLWithString:((ObjectA*)obj[indexPath.row]).imageUrl] placeholderImage:nil success:^(NSURLRequest *request, NSHTTPURLResponse *response, UIImage *image) { CGFloat imageHeight = image.size.height; CGFloat imageWidth = image.size.width; NSLog(@"width of image is %f",imageWidth); NSLog(@"height of image is %f",imageHeight); } failure:^(NSURLRequest *request, NSHTTPURLResponse *response, NSError *error) { ; } ];
However, I get a failure with the error shown, as shown below:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSURL cachePolicy]: unrecognized selector sent to instance 0x1edb9e70'
Does anyone know the cause of this error. Please help if you have any ideas.
tranvutuan
source share