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)

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;