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)

David Fry
David Fry
13,267 Points

Why is this wrong?

import "SignupViewController.h"

import <Parse/Parse.h>

@implementation SignupViewController

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

@end

5 Answers

Stone Preston
Stone Preston
42,016 Points

ok. you have 2 text field properties. you can access the text of those properties using self.usernameField.text and self.passwordField.text. You also have 2 string properties that can be accessed using self.username and self.password.

You need to assign the text contained in the textfields to the username and password properties. see if you can figure it out now. you have to access both the username and password properties as well as the textfield properties using the self keyword.

Stone Preston
Stone Preston
42,016 Points

the task states: "Store the values in the properties 'username' and 'password'."

you stored the values in 2 string variables called username and password, not 2 properties called username and password (hint: you need to access the properties using the self keyword)

David Fry
David Fry
13,267 Points

Ok I am totally lost. I have tried: self.username = usernameField; self.password = passwordField;

self.usernameField = username; self.passwordField = password;

i have added .text on the end of the field ones. I guess I am just not understanding.

David Fry
David Fry
13,267 Points

Ok GOT IT! Thanks for the help. So are self.username and self.password class variables? Meaning are they declared in the .h file?

Stone Preston
Stone Preston
42,016 Points

yes they are declared in the .h as properties, although they are a bit different than your normal instance variables (there is a bit more to them)

David Fry
David Fry
13,267 Points

Thanks for the help Stone!