Let's say that I want to create a GestureRecognizer
object and have my whole logic in there. So when I add the NSObject as target for my recogniser:
initWithTarget:self action:@selector(doTheRecognizerThing:)
I'm facing an issue and I'm not sure why. I get an
unrecognized selector sent to instance
error although the doTheRecognizerThing
method is properly implemented in my NSObject.
If I add the target and implement the method in any other object such as UIView or UIViewController I don't get any issues. Is there an explanation for that?
EDIT
UIPanGestureRecognizer *panGestureRecognizer = [[UIPanGestureRecognizer alloc]initWithTarget:self
action:@selector(doTheRecognizerThing:)];
Implemantation
- (void) doTheRecognizerThing:(UIPanGestureRecognizer *)panGestureRecognizer {
//blah blah blah
}
Error Message:
-[CALayerArray doTheRecognizerThing:]: unrecognized selector sent to instance 0x14648a80
2015-01-06 23:05:20.788 Gestures[2203:1094298] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[CALayerArray doTheRecognizerThing:]: unrecognized selector sent to instance 0x14648a80'