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)

when signing up .... simulator says an error "invalid email address"

please help me out with this,

6 Answers

Gary Luce
Gary Luce
7,153 Points

Can you post your code?

uploaded the code below.... please help me apas . Thank You.

  • (void)viewDidLoad { [super viewDidLoad]; }

  • (IBAction)signup:(id)sender {

    NSString *username = [self.usernameField.text stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]; NSString *password = [self.passwordField.text stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]; NSString *email = [self.emailField.text stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];

    if ([username length] == 0 || [password length] == 0 || [email length] == 0) { UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Oops" message:@"Enter Usename, password, email!" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil]; [alertView show]; } else { PFUser *newUser = [PFUser user];

    newUser.username = username;
    newUser.password = password;
    newUser.email = email;
    
    [newUser signUpInBackgroundWithBlock:^(BOOL succeeded, NSError *error) {
        if (error) {
            UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Sorry!" message:[error.userInfo objectForKey:@"error"] delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
            [alertView show];
        }
        else {
            [self.navigationController popToRootViewControllerAnimated:YES];
        }
    }];
    

    } }

Gary Luce
Gary Luce
7,153 Points

That's weird, I dont see what's wrong with your code. You do seem to have one extra closing bracket but I would guess that your xcode would not compile if that was an issue. If you can upload your project, I can download it and have a look.

please give me your personal email address so that i can forward the zip file to you for furthur assistance. thank you.

Hello, Did anyone get a resolution on this one ?

Actually nothing is written on Parse, and I do not know if the error is coming from Parse or Xcode,

Thanks

Matt Barth
Matt Barth
5,060 Points

Check to see that your email field is labeled properly on your storyboard as "emailField"