【发布时间】:2014-03-04 18:31:05
【问题描述】:
我在 Xcode 5 上安装了 AFNetworking 2.1.0 和 CocoaPods。
//ViewController.h
#import <AFNetworking/AFNetworking.h>
#import <AFNetworking/UIImageView+AFNetworking.h>
在 UIImageview 上调用 setImageWithURLRequest 应用程序失败并显示此日志:
这是错误日志:
2014-02-07 11:55:19.984 OPS[1717:60b] *** Terminating app
due to uncaught exception'NSInvalidArgumentException',
reason: '-[UIImageViewsetImageWithURLRequest:placeholderImage:success:failure:]:
unrecognized selector sent to instance 0x147b06d0'
我发现了一些关于这个问题的讨论,但提供的解决方案(添加 -ObjC -all_load)在我的情况下不起作用。
有什么想法吗?
谢谢
【问题讨论】:
-
您的方法调用中是否缺少空格?您使用哪个版本的 AFNetworking?
-
我正在使用 AFNetworking 2.1.0。没有空格丢失,实际上错误是在运行时而不是在编译时
-
你试过更简单的 [yourImageView setImageWithURL:theImageURL]; ?
-
您可以添加您的代码 sn-p 吗?您是否尝试更新最新的可可豆荚并再次运行 pod install?
-
你能 NSLog 你的 [imageView 类] 吗?只是为了确保在运行时它实际上是一个 UIImageView 并且它没有指向其他东西
标签: ios xcode5 afnetworking cocoapods objective-c-category