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 trialPayton Dwight
5,751 PointsDidn't work
this is the error message:
2015-11-08 15:03:43.433 FunFacts[6730:1079629] -[FunFacts.ViewController ShowFunFact]: unrecognized selector sent to instance 0x7ffd58525dc0 2015-11-08 15:03:43.439 FunFacts[6730:1079629] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[FunFacts.ViewController ShowFunFact]: unrecognized selector sent to instance 0x7ffd58525dc0' *** First throw call stack: ( 0 CoreFoundation 0x0000000102956f45 exceptionPreprocess + 165 1 libobjc.A.dylib 0x000000010467adeb objc_exception_throw + 48 2 CoreFoundation 0x000000010295f56d -[NSObject(NSObject) doesNotRecognizeSelector:] + 205 3 CoreFoundation 0x00000001028aceea ___forwarding_ + 970 4 CoreFoundation 0x00000001028aca98 CF_forwarding_prep_0 + 120 5 UIKit 0x0000000103174e91 -[UIApplication sendAction:to:from:forEvent:] + 92 6 UIKit 0x00000001032e04d8 -[UIControl sendAction:to:forEvent:] + 67 7 UIKit 0x00000001032e07a4 -[UIControl _sendActionsForEvents:withEvent:] + 311 8 UIKit 0x00000001032df8d4 -[UIControl touchesEnded:withEvent:] + 601 9 UIKit 0x00000001031e2ed1 -[UIWindow _sendTouchesForEvent:] + 835 10 UIKit 0x00000001031e3c06 -[UIWindow sendEvent:] + 865 11 UIKit 0x00000001031932fa -[UIApplication sendEvent:] + 263 12 UIKit 0x000000010316dabf _UIApplicationHandleEventQueue + 6844 13 CoreFoundation 0x0000000102883011 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION_ + 17 14 CoreFoundation 0x0000000102878f3c __CFRunLoopDoSources0 + 556 15 CoreFoundation 0x00000001028783f3 __CFRunLoopRun + 867 16 CoreFoundation 0x0000000102877e08 CFRunLoopRunSpecific + 488 17 GraphicsServices 0x0000000106f4aad2 GSEventRunModal + 161 18 UIKit 0x000000010317330d UIApplicationMain + 171 19 FunFacts 0x000000010277b5ed main + 109 20 libdyld.dylib 0x000000010518292d start + 1 ) libc++abi.dylib: terminating with uncaught exception of type NSException (lldb)
Payton Dwight
5,751 Pointsimport UIKit
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
@IBAction func showFunFact() {
print("You pressed me!")
}
}
1 Answer
Nick Kohrn
36,936 PointsOpen Interface Builder and click on the item that you connected to the showFunFact
method in your ViewController
class, which I believe should be a UIButton
. Then, in the Utilities pane on the right of Xcode, click on the Connections Inspector at the far right of the top set of icons in the Utilites pane (a circle icon with an arrow in the middle). Then, you should see that the Touch Up Inside action is connected to the button that you connected to the showFunFact
method in your view controller. If there is a second item with the same connection, then delete the unwanted one.
That is the usual issue for me.
Also, make sure that if you connected a button to the showFunFact
method and then renamed either the method or the button, you will have to delete the connection in the Connections Inspector and reconnect the button to the method in the view controller.
Brendan Whiting
Front End Web Development Techdegree Graduate 84,738 PointsBrendan Whiting
Front End Web Development Techdegree Graduate 84,738 PointsCan you post your code as well?