ios - 使用SDWebImage 加载网络图片时,unrecognized selector sent to instance 。
PHP中文网
PHP中文网 2017-04-17 13:54:02
0
7
749

headImg = (UIImageView *)[cell.contentView viewWithTag:5];
NSURL *ImgURL = [NSURL URLWithString:cellData[@"avatar"]];
[headImg sd_setImageWithURL:ImgURL placeholderImage:[UIImage imageNamed:@"1.jpg"]];

PHP中文网
PHP中文网

认证0级讲师

reply all(7)
刘奇

Looking at it this way, there are two possibilities:
1.[UIImage imageNamed:@"1.jpg"] does not exist
2. Your ImgURL is not the correct URL format

PHPzhong

In UIImageView, the method sd_setImageWithURL cannot be found.

巴扎黑

The sd_setImageWithURL series of methods are in UIImageView+WebCache.h in SDWebImage. You need to import this header file

洪涛

How did you install SDWebImageView? If it is Cocoapods, there should be no problem. The main problem is that the Category is not loaded successfully. You need to add the _ObjC tag. See its official documentation for details.

Ty80

project --> build settings --> Other Linker Flags Add -Objc

Ty80

After adding -ObjC, it still looks like this...

Peter_Zhu

When dragging files in, for the second added folder, select the first one “creat groups!” Do not select the second one “creat folder references”

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template