"Unrecognized selector" is an exception in Cocoa and Cocoa Touch, thrown when an object receives a message to which it cannot respond.
"Unrecognized selector" is an exception in Cocoa and Cocoa Touch, thrown when an object receives a message to which it cannot respond.
This most often means that the object is not of the expected class. For example,
NSDictionary * d = @{@"item_code" : @45};
NSString * code = d[@"item_code"];
NSLog(@"%@", [code uppercaseString]);
will raise this exception, saying
-[__NSCFNumber uppercaseString:]: unrecognized selector sent to instance 0x9028390
because the object is an NSNumber
, not an NSString
despite the type of the pointer.
For useful debugging procedures, see How can I debug 'unrecognized selector sent to instance' error