Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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