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

General Discussion

Help 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

go 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.

that 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

set 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

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

do you know what to do about this? sorry about this just trying to get the hang of it

did 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.

when i type in username that works fine. When i type in the password or email field it breaks down

  • (IBAction)signup:(id)sender;

hmm are you sure thats the line? it should be in your .m file, not in your .h

thats the line that had the blue arrow "- (IBAction)signup:(id)sender;"

can you post some of the other code around that line so I can see it in some context

where do i put the breakpoint or is it a general button

ok. 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.

its the icon second from the right by the way.

this 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

"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:"

i had alot of them so i deleted all of them? where do u want me to place this 1 breakpoint?

nowhere, the exception breakpoint is not placed anywhere specifically, it is triggered when an exception is thrown. Did you delete the exception breakpoint as well?

i cleared all the breakpoints

ok, this time go to debug -> breakpoints -> create exception breakpoint. then run the app and see which line is throwing the exception.

when i do debug add exception break point where should i be on the screen

i deleted all the exception break points because i had 4 of them

ok, you only need one. So add one again.

I did that but how do i find the line. once the app quits i cant seem to fine this blue arrow in the code

it should go to the line automatically. you shouldnt have to find it, it should go to the line for you.

it 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

ok so it happens when you press signup?

any idea?

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

basically 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

nevermind 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

i also get this" return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));"

hmm. 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

whats your email address?

?

its 30 mb too big to send over gmail and i compressed it. how should i get it to you dont have github

im uploading to drop box

let me know when you get it

?