Skip to content

December 12, 2011

unrecognized selector sent to instance

by noise

There’s a simple way to screw your code and get “unrecognized selector sent to instance” error. By dragging an action from an Interface Builder button to the implementation file multiple times. So if you press a button and your app crashes with “unrecognized selector sent to instance” error, select the button that is crashing (when you press it) in Interface builder and go to Connections Inspector. Look there for multiple actions to the same event.

See next screenshot:

unrecognized selector sent to instance

Here we notice Ok button has to connections to the implementation file. If you’ve added by mistake first connection and decide to delete it later, letting only the second one without sender parameter, then we try to run our app, we will notice that our app will crash when we press Ok button.

If we inspect our connections we noticed even if we’ve deleted one of the two actions we still have there both actions. See next picture.

unrecognized selector sent to instance 2

So the problem will be solved by deleting one of the two connections in Connections Inspector.

Read more from Cocoa Errors

Leave a Reply


Note: HTML is allowed. Your email address will never be published.

Subscribe to comments