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 trialdanebeaudette
6,173 PointsProject crashes due to unknown bug.
I am building the Fun Fact app while following along with the videos on treehouse but have come across an bug in my project that I can't fix after adjusting my positioning and size within the story board. When I try to build and run my project it crashes after the app loads in the simulator. The error that is given is as follows,
2016-12-27 11:12:18.746 DaneFunFact[2190:148102] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<DaneFunFact.ViewController 0x7ffa68803f00> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key funFactLabel.' *** First throw call stack:
I believe it has something to do with the App delegate or the IBOutlet connection with he Label I am using. I tried remove all of the added constraints within the main story board and to debug my code. I think the error seems to arise within the AppDelegate at line 12 after the compiler sees @IBOutlet weak var funFactLabel: UILabel! on line 13 of the ViewController. I an give more information if necessary.
2 Answers
Chris Stromberg
Courses Plus Student 13,389 PointsDid you by chance delete the funFactLabel from your code and forget to delete the connection within the connection inspector?
Go to the storyboard, click on the view for your fun fact label. Click on the "show connections inspector" and check to see if the funFactlabel is connected to anything. If it's not connected to anything, either reconnect it or delete this reference.
danebeaudette
6,173 PointsYup. That worked. My label from the storyboard was not connected to the ViewController. Reconnected and it worked right away. Thank you!