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

David Greenstein
6,734 PointsHelp with building the destructive messaging app
i keep getting the error message * Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<SignupViewController 0x9931c30> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key usernamField.' *** First throw call stack:. When i go to the signup page it just quits out. Does anyone know how to fix this?
26 Answers

Stone Preston
42,016 Pointsgo to your signup view controller in storyboard, open the connections inspector, find the outlet connection that has a ! next to its name and delete it. you probably changed the name of an outlet in your .h file without removing the old one first.

David Greenstein
6,734 Pointsthat worked and fixed 75% of the problem but how do i go about fixing this 2014-02-13 12:49:17.591 Ribbit[22814:70b] -[SignupViewController emailField:]: unrecognized selector sent to instance 0x9a78c10 2014-02-13 12:49:17.596 Ribbit[22814:70b] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[SignupViewController emailField:]: unrecognized selector sent to instance 0x9a78c10' *** First throw call stack: thanks so much

Stone Preston
42,016 Pointsset an exception breakpoint in your project by selecting (in the xcode menu bar) debug -> breakpoints -> create exception breakpoint. Then run the code and it will break at the line of code that is throwing the exception

David Greenstein
6,734 Pointsalll it says is this 2014-02-13 12:53:36.509 Ribbit[22893:70b] -[SignupViewController passwordField:]: unrecognized selector sent to instance 0x9b72bc0 (lldb)

David Greenstein
6,734 Pointsdo you know what to do about this? sorry about this just trying to get the hang of it

Stone Preston
42,016 Pointsdid you set the breakpoint, when the exception is thrown the line of code will be highlighted with a blue arrow to the left of it. post the line of code that is throwing the exception. that error message isnt very helpful, however the line of code that is causing the error will be.

David Greenstein
6,734 Pointswhen i type in username that works fine. When i type in the password or email field it breaks down

David Greenstein
6,734 Points- (IBAction)signup:(id)sender;

Stone Preston
42,016 Pointshmm are you sure thats the line? it should be in your .m file, not in your .h

David Greenstein
6,734 Pointsthats the line that had the blue arrow "- (IBAction)signup:(id)sender;"

Stone Preston
42,016 Pointscan you post some of the other code around that line so I can see it in some context

David Greenstein
6,734 Pointswhere do i put the breakpoint or is it a general button

Stone Preston
42,016 Pointsok. first lets see if you accidently added a breakpoint somewhere else. open the breakpoints view by clicking the breakpoint icon thats on the far left of your xcode screen. where the file, search, warnings icons are (looks like a tab with an arrow on the right) and see if you have any breakpoints other than the exception breakpoint you set earlier. if you have more than that, right click and delete it.

Stone Preston
42,016 Pointsits the icon second from the right by the way.

David Greenstein
6,734 Pointsthis is SignupViewController.m
import "SignupViewController.h"
@interface SignupViewController ()
@end
@implementation SignupViewController
(void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view. }
-
(IBAction)signup:(id)sender {
NSString *username = [self.usernameField.text stringByTrimmingCharactersInSet: [NSCharacterSet whitespaceAndNewlineCharacterSet]]; NSString *password = [self.passwordField.text stringByTrimmingCharactersInSet: [NSCharacterSet whitespaceAndNewlineCharacterSet]]; NSString *email = [self.emailField.text stringByTrimmingCharactersInSet: [NSCharacterSet whitespaceAndNewlineCharacterSet]];
if ([username length] == 0 ||[password length] == 0 || [email length] == 0) { UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Oops!" message:@"Make sure you enter a username, password, and email address!" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil]; [alertView show]; } } @end

David Greenstein
6,734 Points"4-02-13 13:03:04.618 Ribbit[23057:70b] -[SignupViewController passwordField:]: unrecognized selector sent to instance 0x985e210 2014-02-13 13:03:04.623 Ribbit[23057:70b] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[SignupViewController passwordField:]: unrecognized selector sent to instance 0x985e210' *** First throw call stack:"

David Greenstein
6,734 Pointsi had alot of them so i deleted all of them? where do u want me to place this 1 breakpoint?

Stone Preston
42,016 Pointsnowhere, the exception breakpoint is not placed anywhere specifically, it is triggered when an exception is thrown. Did you delete the exception breakpoint as well?

David Greenstein
6,734 Pointsi cleared all the breakpoints

Stone Preston
42,016 Pointsok, this time go to debug -> breakpoints -> create exception breakpoint. then run the app and see which line is throwing the exception.

David Greenstein
6,734 Pointswhen i do debug add exception break point where should i be on the screen

David Greenstein
6,734 Pointsi deleted all the exception break points because i had 4 of them

Stone Preston
42,016 Pointsok, you only need one. So add one again.

David Greenstein
6,734 PointsI did that but how do i find the line. once the app quits i cant seem to fine this blue arrow in the code

Stone Preston
42,016 Pointsit should go to the line automatically. you shouldnt have to find it, it should go to the line for you.

David Greenstein
6,734 Pointsit is definitely not doing that because the app doesnt shut down till i start entering in the password or email field then pressing the sign up button

Stone Preston
42,016 Pointsok so it happens when you press signup?

David Greenstein
6,734 Pointsany idea?

David Greenstein
6,734 Pointsall i get is "2014-02-13 13:06:39.423 Ribbit[23096:70b] -[SignupViewController passwordField:]: unrecognized selector sent to instance 0x9a62390 (lldb) "

David Greenstein
6,734 Pointsbasically when i leave a field blank it should bring up a mesasge telling me to add content to the field. the username section works perfectly. Sometimes the password works if i enter that then username. But whenever i touch email and sometimes password the app just quits

David Greenstein
6,734 Pointsnevermind the problem is if i enter anything into 1 field that works even email field but if i switch to entering into another field for instance from username to password or email to password then it quits

David Greenstein
6,734 Pointsi also get this" return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));"

Stone Preston
42,016 Pointshmm. this is getting hard to debug without seeing the project. Could you zip it up and email it or push it to github or something so I can take a closer look

David Greenstein
6,734 Pointswhats your email address?

Stone Preston
42,016 Points
David Greenstein
6,734 Points?

David Greenstein
6,734 Pointsits 30 mb too big to send over gmail and i compressed it. how should i get it to you dont have github

David Greenstein
6,734 Pointsim uploading to drop box

David Greenstein
6,734 Points
David Greenstein
6,734 Pointslet me know when you get it

David Greenstein
6,734 Points?