我在
Xcode 5上安装了带有CocoaPods的AFNetworking 2.1.0.
//ViewController.h #import <AFNetworking/AFNetworking.h> #import <AFNetworking/UIImageView+AFNetworking.h>@H_404_4@在UIImageview上调用setImageWithURLRequest,应用程序失败并显示以下日志: @H_404_4@这是错误日志:
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'@H_404_4@我已经找到了关于这个问题的一些讨论,但提供的解决方案(添加-ObjC -all_load)在我的情况下不起作用. @H_404_4@任何的想法? @H_404_4@谢谢
解决方法
我对Xcode 5,Cocoapods和AFNetworking 1.3.3也有同样的问题.
@H_404_4@我在Google网上论坛讨论中找到了答案:AFNetworking unrecognized selector
@H_404_4@Make sure your project and target settings aren’t overwriting the values in the xcconfig file. @H_404_4@Each level should have (at least) $(inherited) to inherit the settings of the parent.@H_404_4@在Build Settings中,确保在Other Linker Flags中有$(继承). @H_404_4@在添加$(继承)之前构建设置(选择级别,而不是组合): @H_404_4@添加$(继承)后构建设置: @H_404_4@那为我修好了.