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 Simple iPhone App with Objective-C Views and View Controllers IBOutlet

Crashing?

When i go to press the button "showFunFact" the app just crashes, in the Console "**** Terminating app due to uncaught exception"

Can you post your code? It's easier to help if I can see what you got.

I am using the exact same code as the video demonstrates?

If you were, your app would not crash, maybe you misspelled something?

Do you think it's because I put universal

I got it. i changed the target to iPhone. if i was to make this app on iPad how would i do it, that was the problem? does it have separate code? Like IOS and OS X have separate code?

No. The code is the same. I don't know what triggered the problem because I can't see your code. Maybe the size classes were causing the issue? Who knows..

2 Answers

Nahum Maciel
Nahum Maciel
3,801 Points

I have the same crash report. Here is what mine looks like:

2015-05-29 19:33:38.771 FunFacts[6065:693663] -[ViewController showFunFact:]: unrecognized selector sent to instance 0x7fa67ae1d6a0 2015-05-29 19:33:38.773 FunFacts[6065:693663] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[ViewController showFunFact:]: unrecognized selector sent to instance 0x7fa67ae1d6a0' *** First throw call stack: ( 0 CoreFoundation 0x0000000107c70c65 exceptionPreprocess + 165 1 libobjc.A.dylib 0x0000000107909bb7 objc_exception_throw + 45 2 CoreFoundation 0x0000000107c780ad -[NSObject(NSObject) doesNotRecognizeSelector:] + 205 3 CoreFoundation 0x0000000107bce13c ___forwarding_ + 988 4 CoreFoundation 0x0000000107bcdcd8 CF_forwarding_prep_0 + 120 5 UIKit 0x000000010806ada2 -[UIApplication sendAction:to:from:forEvent:] + 75 6 UIKit 0x000000010817c54a -[UIControl _sendActionsForEvents:withEvent:] + 467 7 UIKit 0x000000010817b919 -[UIControl touchesEnded:withEvent:] + 522 8 UIKit 0x00000001080b7998 -[UIWindow _sendTouchesForEvent:] + 735 9 UIKit 0x00000001080b82c2 -[UIWindow sendEvent:] + 682 10 UIKit 0x000000010807e581 -[UIApplication sendEvent:] + 246 11 UIKit 0x000000010808bd1c _UIApplicationHandleEventFromQueueEvent + 18265 12 UIKit 0x00000001080665dc _UIApplicationHandleEventQueue + 2066 13 CoreFoundation 0x0000000107ba4431 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION_ + 17 14 CoreFoundation 0x0000000107b9a2fd __CFRunLoopDoSources0 + 269 15 CoreFoundation 0x0000000107b99934 __CFRunLoopRun + 868 16 CoreFoundation 0x0000000107b99366 CFRunLoopRunSpecific + 470 17 GraphicsServices 0x000000010b1a9a3e GSEventRunModal + 161 18 UIKit 0x0000000108069900 UIApplicationMain + 1282 19 FunFacts 0x00000001073d8dcf main + 111 20 libdyld.dylib 0x000000010a228145 start + 1 ) libc++abi.dylib: terminating with uncaught exception of type NSException

David Uriah Garrett Lir
David Uriah Garrett Lir
5,395 Points

When you created your IBAction did you select, None for arguments? You have to select none, if you select something else then delete code to get rid of the arguments it want work properly.