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)

Help with code challenge

#import "SignupViewController.h"
#import <Parse/Parse.h>

@implementation SignupViewController

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

@end

I have also tried the stringWithTrimmingCharactersInSet similar to the previous video and that one doesn't work either. Is it not working because I am trying to store the values as strings?

3 Answers

Elias Thanasopoulos
Elias Thanasopoulos
32,286 Points

can you try this:

'- (IBAction)login:(id)sender { NSString *username = [self.usernameField.text stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]; NSString *password = [self.passwordField.text stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]; }'

Yes, I did try this as well since this is the way it was done in the previous video but I get the feed back Bummer! Make sure you set both the 'username' and 'password' properties!

Are the textFields on the viewController in the storyboard connected to the properties on the .h file? This link https://developer.apple.com/library/ios/documentation/StringsTextFonts/Conceptual/TextAndWebiPhoneOS/ManageTextFieldTextViews/ManageTextFieldTextViews.html could be of some for you in how to use textFields.

I figured out the answer I just had one question regarding this. In the video Ben assigned the username and password to a string. If I use the following code what is it being stored as? Does the .text make it a string? self.username = self.userNameField.text;