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
Will Lam
7,027 PointsFunFacts app error
Getting this error:
FunFacts[47444:1916432] -[UIButton setText:]: unrecognized selector sent to instance 0x7c91dda0 2014-12-24 16:02:30.597 FunFacts[47444:1916432] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIButton setText:]: unrecognized selector sent to instance 0x7c91dda0'
I can't quite pin-point where I"m going wrong.. I'm guessing I'm pointing to the wrong thing for the "show another fun fact" button?
Michelle Hermanson
1,949 PointsDid you solve this? I am getting the same error as soon as I try to connect the button to the label. I tried restarting Xcode and the simulator-- same problem. Then I tried deleting code for updating the text from the ViewController and just going back to having the println() when the button was clicked -- same problem. Then I removed the label and the button from the ViewController and the storyboard. I should just be able to bring up an app with an empty screen. Still same issue. I don't know where this FunFactLabel is still defined/being used.
I guess my next approach will be to start a new project. But I have the feeling the same things will happen...
3 Answers
Stephen Whitfield
16,771 PointsDoes UIButton have a method called "setText"? Maybe you're wanting to implement "setTitle:forState:"?
Stephen Whitfield
16,771 PointsMichelle Hermanson: sounds like your issue may be related to a floating pointer. Check your views in storyboard and make sure the subviews are all being pointed to.
Michelle Hermanson
1,949 PointsThanks, Stephen. I don't have any subviews, I am just in the beginning of the course trying to add one button and one label. But, you are right it's a reference to something that doesn't exist any more... I found a post that explained the problem and how to find the code and delete it from the story board.
Stephen Whitfield
16,771 PointsI figured as much. I've made the same mistake plenty of times. Good luck!
Nick Janes
5,487 PointsNick Janes
5,487 PointsAre you calling a setText method? Can I see the code in your classes?