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)

I'm getting an Expected Identifier error and I can't pinpoint why.

Below is the code for my Ribbit app. After my UIAlerView, before the alertView show part, I'm getting an Expected Identifier error. I checked my code against the downloadable code in the class - and they look the same. The other problem is, the downloadable file doesn't run - it's laced with errors, too. So I have no examples of working code to check my code against. Does anyone know why I'm getting this Expected Identifier error? Thanks!

        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];

            }
            }];
    }
}

Hey Levi, check the Markdown Cheatsheet to see how to post code on the forums. I've fixed it up for you.

1 Answer

Ravee Sundar
PLUS
Ravee Sundar
Courses Plus Student 1,975 Points

you have an extra "[" in your alertView creation. Try this

UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Sorry!" message:[error.userInfo objectForKey:@"error"] delegate:nil cancelButtonTitle:@"OK" otherButtonTitles: nil];