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 Build a Self-Destructing Message iPhone App Using Parse.com as a Backend and Adding Users Signing Up New Users: Part 2 (PFUser)

Alexander Tewpin
Alexander Tewpin
10,378 Points

Can't pass the first step of this task

I tried numerous variants of code that worked perfectly in Xcode and still have no idea what I did wrong.

NSString *username = self.usernameField.text;
NSString *password = self.passwordField.text;

Not working.

NSString *username = [self.usernameField.text stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
NSString *password = [self.passwordField.text stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];

Still says I need to set both properties.

Did I miss something or it's site malfunction?

2 Answers

Stone Preston
Stone Preston
42,016 Points

you need to set both properties. username and password are both string properties of the controller. you need to access them using self.username and self.password. You are currently creating 2 new variables username and password which is why your answer is incorrect

Alexander Tewpin
Alexander Tewpin
10,378 Points

Oh, I get it, thanks a lot. But why view controller need that properties anyway? Isn't local variables simpler? Program hardly will call this properties out of signup view.

Stone Preston
Stone Preston
42,016 Points

yes thats true, thats just the way the challenge is designed. It says that username and password are properties, so you must treat them as such