[objective-c] "unrecognized selector sent to instance" error in Objective-C

Basics: Dynamic Invocation

The objective C is a dynamic language which invokes methods by looking at runtime for methods in classes. For example, if there is Class A including method DoSomething(arg1, arg2). If you try to call the method using correct arguments on an object of Class A everything will work fine. However, if the arguments are not passes properly, for example, you called the method with one argument only then the the run-time will treat this as a method call for a different method. Eventually, run-time will fail to find the method (DoSomething with one argument) and will through this exception "unrecognized selector sent to instance".

Solution

Please check what signature for @selector is expected. Usually it is, as you described in the code

-(IBAction)numberButtonClick:(id)sender{