Error: unrecognized selector

I'm taking a course online, and working through my very first IOS project.

Topic: Buttons and IBaction

when stepping through the project to create an IBaction for my button. I notice the code in the training video was different than the code my xcode generated when dragging a button from the storyboard to the viewcontroller.

So I deleted the code that I generated from the veiwcontroller.h and .m file and started the process over again.  

Ever since I deleted the code,  the program will not work.  In the simulator when I click my button i get an error.

I tried doing a clean build (command-option-shift-k) that did not work.  I deleted the code again, and ran it through the simulator and when I click the button it still crashes.

I know if I delete the project and start over it would work.  But I am more interested in finding what went wrong and how can I fix this solution in the future.

I attached the error message.
screenshot1.gif
mmsiAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

pgnatyukCommented:
When Xcode generated a code for you - an method that is called when the user clicks on the button - this IBAction, it connected the button you see on the screen with your project (visually there was a dot before text '- IBAction'). You deleted the code but you didn't deleted the connection points. When you added a new method, probably, you didn't connect it with the
button on the screen. You can do it and it will fix your current project.

Maybe, at this stage, it can be easier and faster to re-create the project and do everything again.
0
mmsiAuthor Commented:
I was playing around with the project, and realized that if I could just delete the button the button off the storyboard.

Question: Where are the connection points that you mention?


For example: C#

If I drag a button to the form and create a click event.  Visual Studio generates EventHandlers for me.  So If I delete the click event, then compile the program crashes.  I would then just delete the EventHandler that visual studio created, and then recompile the error would go away.

Is this a similar situation?  Where xcode is creating some kind of connection, that I can just delete and the error would go away?  I deleted the code I generated, but I am not sure why the error is occurring when the code is gone.
0
pgnatyukCommented:
Not exactly.
Objective-C is a dynamic language - almost everything happens in the run-time (In C# the compiler checks everything)

I hope you already know about a storyboard and about the xib-files. These connections are there. You work with these file in Interface Builder. Here you can delete this connection: select this button and in the connection inspector you will the connection - Touch Up Inside should be connected with a method - I attached a screenshot. If you see it, click on the cross.
Screenshot
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
mmsiAuthor Commented:
Thank you, this is the solution I was looking for.
0
pgnatyukCommented:
You are welcome
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Swift Programming

From novice to tech pro — start learning today.