简体   繁体   English

由于SDWEbImage中未捕获的异常'NSInvalidArgumentException'而终止应用

[英]Terminating app due to uncaught exception 'NSInvalidArgumentException' in SDWEbImage

I am trying to load images in my Table-list cells and for this i am using SDWebImage with pod 'SDWebImage', '~>3.8' . 我试图在我的表列表单元格中加载图像,为此,我将SDWebImage'SDWebImage', '~>3.8'

Since 4 days on words I am getting exception like below 自从4天的文字以来,我正在收到如下异常

Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIImageView sd_setImageWithURL:placeholderImage:]: unrecognized selector sent to instance 0x79685270 由于未捕获的异常'NSInvalidArgumentException'而终止应用程序,原因:'-[UIImageView sd_setImageWithURL:placeholderImage:]:无法识别的选择器发送到实例0x79685270

Please can someone help me find what I'm doing wrong in my code 请有人可以帮我找到我在代码中做错的事情吗

code:- 码:-

#import <SDWebImage/UIImageView+WebCache.h>
#import "UIImageView+Cached.h"

[cell.mainimage sd_setImageWithURL:[NSURL URLWithString:url]placeholderImage:[UIImage imageNamed:@"placeholder.png"]];

Podfile Podfile

platform :ios, '7.0'. 平台:ios,“ 7.0”。
pod 'SDWebImage', '~>3.8' pod'SDWebImage','〜> 3.8'

If you are using Swift, be sure to add use_frameworks! 如果您正在使用Swift,请确保添加use_frameworks! and set your target to iOS 8+: 并将目标设置为iOS 8+:

platform :ios, '8.0' . 平台:ios,“ 8.0”。
use_frameworks! use_frameworks!

It seems that the extension cannot be found at runtime. 似乎在运行时找不到扩展名。

You need to make sure that your project is linked with the framework in the right way. 您需要确保您的项目以正确的方式与框架链接。

You can try the following: 您可以尝试以下方法:

  1. run pod update SDWebImage in the terminal - if you are getting the error since you updated the version 在终端中运行pod update SDWebImage如果由于更新版本而出现错误
  2. change the way you use the framework, using @import SDWebImage; 使用@import SDWebImage;更改使用框架的方式@import SDWebImage;

Does this work? 这样行吗?

Hope you find this useful 希望你觉得这个有用

[cell.imageView sd_setImageWithURL:url
              placeholderImage:nil
                     completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, NSURL *imageURL) {
                            if (error) {
                              self.imageView.image = [UIImage imageNamed:@"yourPlaceholderImageName"];
                            } else {
                              self.imageView.image = image;
                            }
}];

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 “因未捕获的异常而终止应用程序&#39;NSInvalidArgumentException&#39;” - “Terminating app due to uncaught exception 'NSInvalidArgumentException'” 由于未捕获的异常&#39;NSInvalidArgumentException 4而终止应用程序 - Terminating app due to uncaught exception 'NSInvalidArgumentException 4 ***由于未捕获的异常&#39;NSInvalidArgumentException&#39;而终止应用, - *** Terminating app due to uncaught exception 'NSInvalidArgumentException', 由于未捕获而终止应用程序 &gt; 异常“NSInvalidArgumentException” - Terminating app due to uncaught > exception 'NSInvalidArgumentException' 由于未捕获的异常“ NSInvalidArgumentException”而终止应用程序,NSUserDefaults? - Terminating app due to uncaught exception 'NSInvalidArgumentException', NSUserDefaults? 由于未捕获的异常“ NSInvalidArgumentException”而终止应用程序, - Terminating app due to uncaught exception 'NSInvalidArgumentException', 由于未捕获的异常NSInvalidArgumentException而终止应用程序 - Terminating app due to uncaught exception NSInvalidArgumentException 是否由于未捕获的异常“ NSInvalidArgumentException”而终止应用程序? - Terminating app due to uncaught exception 'NSInvalidArgumentException'? 由于未捕获的异常&#39;NSInvalidArgumentException&#39;错误而终止应用程序 - Terminating app due to uncaught exception 'NSInvalidArgumentException' error iOS - 由于未捕获的异常&#39;NSInvalidArgumentException&#39;而终止应用程序 - iOS - Terminating app due to uncaught exception 'NSInvalidArgumentException'
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM