Reputation: 151
i am trying to integrate the AFNetworking class for UIButton (i am calling a profile page and am loading in the avatar for the user async'd).
https://gist.github.com/dpettigrew/2925847
Xcode error: -[UIRoundedRectButton setImageWithURL:placeholderImage:forState:]: unrecognized selector sent to instance 0xd2431a0
I tried to follow this example (https://github.com/luisespinoza/ActivityIndicatorImageURL) and i'm getting the same error on the UIImageView too.
I verified that all the files are copied into xcode and including in the build phases area. The thing that doesn't make sense though, is when i hold command and click the method, where i'm calling it, it jumps to the right method no problem. Any ideas? how do i get xcode to find the method on run time?
self->avatar
is the UIButton linked via an IBOutlet in my storyboard.
UIImage *imageTemp = [UIImage imageNamed:@"default_avatar.png"];
[self->avatar setImageWithURL:url placeholderImage:imageTemp forState:UIControlStateNormal];
Also note that i do have the following in my .h
#import "UIButton+AFNetworking.h"
#import "UIImageView+AFNetworking.h"
Upvotes: 1
Views: 701
Reputation: 17374
Edit: My previous answer is totally wrong, because subclass inherit methods of the superclass. I answered like it were a class cluster.
Are you using AFNetworking as a static library? If so, you have to add the -ObjC linker flag.
Look the accepter solution here:(Objective-C categories in static library)
Upvotes: 1
Reputation: 151
if you come across this and can't ifgure it out, i recommend trying UIButton+WebCache.h
unfortunately i had issues with this too (the cache was far too strict, only looking at the URL and payload size, which were always the same so it never got reset, so i just don't use the cache part)
Upvotes: 0
Reputation: 299
I am not sure what the issue is but here is a sample project that uses both the UIButton and the UIImageView categories
http://numberpress.co/personal/UIButtonAFNetworkingTest.zip
Upvotes: 0