search

Home  >  Q&A  >  body text

ios - 使用SDWebImage 加载网络图片时,unrecognized selector sent to instance 。

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

PHP中文网PHP中文网2773 days ago758

reply all(7)I'll reply

  • 怪我咯

    怪我咯2017-04-17 13:56:02

    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

    reply
    0
  • PHPz

    PHPz2017-04-17 13:56:02

    In UIImageView, the method sd_setImageWithURL cannot be found.

    reply
    0
  • 巴扎黑

    巴扎黑2017-04-17 13:56:02

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

    reply
    0
  • PHP中文网

    PHP中文网2017-04-17 13:56:02

    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.

    reply
    0
  • PHP中文网

    PHP中文网2017-04-17 13:56:02

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

    reply
    0
  • PHP中文网

    PHP中文网2017-04-17 13:56:02

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

    reply
    0
  • 天蓬老师

    天蓬老师2017-04-17 13:56:02

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

    reply
    0
  • Cancelreply