Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

iOS Build a Playlist Browser with Objective-C Working With Multiple View Controllers Recap of iOS Basics

Not working with xcode 8 and IPhone 7 plus emulator This is what I get on button press, it crashes

2017-03-05 09:11:30.913 Algorythm[39363:503939] -[ViewController buttonPressed]: unrecognized selector sent to instance 0x7f9e73503570 2017-03-05 09:11:30.918 Algorythm[39363:503939] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[ViewController buttonPressed]: unrecognized selector sent to instance 0x7f9e73503570' *** First throw call stack: ( 0 CoreFoundation 0x000000010a6dfd4b exceptionPreprocess + 171 1 libobjc.A.dylib 0x000000010a14121e objc_exception_throw + 48 2 CoreFoundation 0x000000010a74ff04 -[NSObject(NSObject) doesNotRecognizeSelector:] + 132 3 CoreFoundation 0x000000010a665005 ___forwarding_ + 1013 4 CoreFoundation 0x000000010a664b88 CF_forwarding_prep_0 + 120 5 UIKit 0x000000010ab058bc -[UIApplication sendAction:to:from:forEvent:] + 83 6 UIKit 0x000000010ac8bc38 -[UIControl sendAction:to:forEvent:] + 67 7 UIKit 0x000000010ac8bf51 -[UIControl _sendActionsForEvents:withEvent:] + 444 8 UIKit 0x000000010ac8ae4d -[UIControl touchesEnded:withEvent:] + 668 9 UIKit 0x000000010ab73545 -[UIWindow _sendTouchesForEvent:] + 2747 10 UIKit 0x000000010ab74c33 -[UIWindow sendEvent:] + 4011 11 UIKit 0x000000010ab219ab -[UIApplication sendEvent:] + 371 12 UIKit 0x000000010b30e72d __dispatchPreprocessedEventFromEventQueue + 3248 13 UIKit 0x000000010b307463 __handleEventQueue + 4879 14 CoreFoundation 0x000000010a684761 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION_ + 17 15 CoreFoundation 0x000000010a66998c __CFRunLoopDoSources0 + 556 16 CoreFoundation 0x000000010a668e76 __CFRunLoopRun + 918 17 CoreFoundation 0x000000010a668884 CFRunLoopRunSpecific + 420 18 GraphicsServices 0x000000010e4d1a6f GSEventRunModal + 161 19 UIKit 0x000000010ab03c68 UIApplicationMain + 159 20 Algorythm 0x0000000109b6c9bf main + 111 21 libdyld.dylib 0x000000010d54168d start + 1 22 ??? 0x0000000000000001 0x0 + 1 ) libc++abi.dylib: terminating with uncaught exception of type NSException

2 Answers

Hey Terrence, I'm assuming you set up your button with an @IBAction, so heres whats happening. If you set up your button with an IBAction, and want to modify that action or change it to another, you can't simply just delete that action from your code and link up your button with another. What's happening is your button is still linked with an action that isn't there, hence the "[ViewController buttonPressed]: unrecognized selector sent to instance ". You need to go into your storyboard and right click on your button, this will show you all the outlets and actions currently linked to it. Remove the one or ones you don't need from there and you should be good to go! Also, this can also occur with IBOutlets as well so make sure to double check!

Thank you, this has solved the problem