Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CocoaPods UIImageView+AFNetworking.h unrecognized selector setImageWithURLRequest

I have installed AFNetworking 2.1.0 with CocoaPods on Xcode 5.

//ViewController.h
#import <AFNetworking/AFNetworking.h>
#import <AFNetworking/UIImageView+AFNetworking.h>

Calling setImageWithURLRequest on an UIImageview the application fail with this log:

This is the error log:

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'

I've found some discussion on this issue, but the provided solution (adding -ObjC -all_load) not working in my case.

Any idea?

Thanks

like image 585
PGLongo Avatar asked Feb 07 '14 11:02

PGLongo


1 Answers

I had the same problem with Xcode 5, Cocoapods and AFNetworking 1.3.3.

I found my answer in this Google Groups discussion: AFNetworking unrecognized selector

Make sure your project and target settings aren't overwriting the values in the xcconfig file.

Each level should have (at least) $(inherited) to inherit the settings of the parent.

In Build Settings, make sure you have $(inherited) in Other Linker Flags.

Build Settings before I added $(inherited) (choose Levels, not Combined):

Other Linker Flags without $(inherited)

Build Settings after I added $(inherited):

Other Linker Flags with $(inherited)

That fixed it for me.

like image 86
Steph Sharp Avatar answered Sep 27 '22 23:09

Steph Sharp