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)

cannot set username and password from text field inputs

create a user, stage 1 of 4 challenge: Tree House compiler does not accept my solution. '''objective c NSString *username = self.usernameField.text; NSString *password = self.passwordField.text; '''

3 Answers

Gareth Borcherds
Gareth Borcherds
9,372 Points

The challenge doesn't tell you to create a NSString named password and username and store the values to it, it tells you to store the values in properties named username and password, which means that in our .h file we would have something like:

@property (nonatomic, strong) NSString *username;
@property (nonatomic, strong) NSString *password;

So that means we simply need to access that property and set it's value, just like you are doing, but just do it to the properties already created for us. (I know it's confusing...)

- (IBAction)signup:(id)sender {
    self.username = self.usernameField.text;
    self.password = self.passwordField.text;
}

hey there! remove the * from *username and *password and try that, could you post the question again?

Soojin Ro
Soojin Ro
13,331 Points

What's with the "objective c" in the beginning?

Gareth Borcherds
Gareth Borcherds
9,372 Points

The objective-c comes from trying to use markdown unsuccessfully, it looks like she used an apostrophe instead of a back tick to create the code blocks that I created below.