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 trialDavid Fry
13,267 PointsWhy 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
42,016 Pointsok. 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
42,016 Pointsthe 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
13,267 PointsOk 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
13,267 PointsOk 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
42,016 Pointsyes 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
13,267 PointsThanks for the help Stone!
Stone Preston
42,016 Pointsno problem : )