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
Rashii Henry
16,433 PointsCreating a Self destructing message>> Logging In
for some strange reason whenever i try to log in with a user that i just created it always says that i have an invalid username and password. Ive tried deleting users from parse.com and creating new ones, no matter how simple or complex the usernames are the log in credentials don't seem to match for me to login.
Also, i have no errors in my code and it runs just fine.
here's my login view controller.m:
- (IBAction)login:(id)sender {
NSString *username = [self.usernameField.text stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
NSString *password = [self.passwordField.text stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
if ([username length] == 0 || [password length] == 0)
{
UIAlertView *alertView =[[UIAlertView alloc] initWithTitle:@"Oops!"
message:@"Make sure you enter a username and password!" delegate: nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
[alertView show];
}
else {
[PFUser logInWithUsernameInBackground:username password:password block:^(PFUser *user, NSError *error) {
if (error) {
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Please check username and/or password and try again!" message:[error.userInfo objectForKey:@"error"] delegate:nil cancelButtonTitle:@"OK"otherButtonTitles: nil];
[alertView show];
}
else {
[self.navigationController popToRootViewControllerAnimated:YES];
}
}];
}
}
@end
4 Answers
Amit Bijlani
Treehouse Guest TeacherVerify that your ApplicationId and ClientKey match up if you have multiple applications defined on Parse.
Dandre Connolly
1,101 PointsRashii - did you ever resolve this? I'm having the same issue.
Rashii Henry
16,433 PointsI believe all I did was create a new app on parse with another id and etc.. either that or completely started over on the project.
Jack Ryder
7,286 PointsI have the same problem, any other advice apart from starting over?
Rashii Henry
16,433 PointsRashii Henry
16,433 PointsThanks Amit,
but the applicationId and the ClientKey do match up. I only have one application that is using parse and that's the self destructing message.
Amit Bijlani
Treehouse Guest TeacherAmit Bijlani
Treehouse Guest TeacherThe only other suggestion I have would be to add NSLogs to output the contents of
usernameandpassword. And set breakpoints to step through your code.