objective c - Unrecognized Selector Sent to Instance; selector doesn't exist? -



objective c - Unrecognized Selector Sent to Instance; selector doesn't exist? -

so i'm new objective c, practically new programming in general.

anyway, in simple program, control-dragged uitextfield storyboard viewcontroller.m thinking way create method invoked when field entered/tapped on. wasn't long until deleted method.

when running simulator, keyboard come , text field focused on. if tapped anywhere else on screen, resulted in crash giving me unrecognized selector error selector deleted.

there's nil in viewcontroller.h , rest of code seems fine. if re-add selector no instructions, behaves intended , keyboard resigns. question is, why getting error?

it more helpful have output of crash. said suspect storyboard still has outlet hooked up, referencing function or outlet created. storyboard click on textfield , navigate connections inspector (view -> utilities -> connections inspector). there should able see connections have made. click x rid of it.

the connection inspector icon in upper right right facing arrow within of circle.

edit:

i realized asked why happening , not how prepare it. unrecognized selector means sounds like. code, in case storyboard trying phone call method or access variable on object doesn't implement method. compiler catches these types of errors in code there cases can't catch, 1 experiencing. illustration ok assign nsarray object variable declared else, nsstring follows

id object = @[@"hello", @"world"]; nsstring *notastring = object; [notastring length];

try running , crash similar error because nsarray implement length method, or in objective-c speak, doesn't respond selector "length".

objective-c xcode

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -