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

iOS

Ribbit - Setting Up Parse and Checking UN, PW, Em for blank characters.

I've already implemented Parse and the test worked. However, I'm now in SignUpViewController and in my Submit button method (sorry if I get the vocab a little wrong... I'm still mastering it.)...

I'm checking to make sure the Password, Username, and Email fields are not blank, plus stripping them of any blank characters. This includes the Alert Notification.

I've run through the code and it all looks good. I'll keep going through it incase if I missed something (it gets hypnotizing after awhile)... but I keep getting this error when I run my app:

2014-05-10 07:48:47.045 Ribbit[537:60b] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<LoginViewController 0x9b8ef30> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key passwordField.'

I see it's referencing the LoginViewController... but besides connecting my Login View with the actual LoginViewController class, there is no code in there.

2 Answers

This happens when you add a connection, then rename it in your property declaration later on

go to your storyboard and open the connections editor (its near the attributes, size inspector etc) you will see a connection to your password text field (possibly more than one). remove it by clicking the x. then delete your code in your .h that declares the password text field as a property. then click and drag from your text field in storyboard to your .h to reconnect the property. make sure you give it the same name as you used to reference in your code. That should fix it.

Thanks Stone. That worked like a charm. I'm still a little confused on what I did the first time to not make it work. However, I guess as I keep going through this, I'll keep learning. Thanks for the help!

Hi Dan go into your stack trace when the app crashes this will tell you when the error is coming up and pop on your break points to see which line is throwing out the error.

From this error

2014-05-10 07:48:47.045 Ribbit[537:60b] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[ setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key passwordField.'

From your code it will be one of these things

  1. You have a property which is not referenced properly, you may have changed its name or deleted it in that view controller. You will see what I mean when you fire it up in Xcode that there is broken link.

  2. Or you have an Object within your view controller class which you have defined a property type for an object which it can't accessed. When it says

'key value coding-compliant for the key passwordField.'

Your object which you have defined is unable to access a value defined simply because it was maybe the wrong type. Remember with objects it key-value pairing and using the key to get the value. So I think in this case you have a key passwordField which can't seem to access it's property ( that is the user password) likely hood there should be a NSString for it to access when it runs this method that you may have not defined as a parameter of the object.

It could be that you typed a @"PasswordField" instead of passwordField and its throwing a error.

Without your code I can't go into it much more detail but just from your console output thats what I would make a educated guess at.

Hope this helps!!

Hi Sam, thanks for the help. I looked back and I think I had the wrong view controller (loginviewcontroller) fields referenced in the signupviewcontroller header file. I'm thinking that was my issue. Thanks again for the help!