Code for the login:
[PFUser logInWithUsernameInBackground:self.userTextField.text password:self.passwordTextField.text block:^(PFUser *user, NSError *error) {
if (user) {
[self performSegueWithIdentifier:@"LoginSuccesful" sender:self];
}
else {
NSInteger code = [error code];
NSString *message;
if (code == 100) {
message = @"No Internet Connection";
}
else if(code == 101) {
message = @"Wrong credentials";
}
UIAlertView *errorAlertView = [[UIAlertView alloc] initWithTitle:@"Error" message:message delegate:nil cancelButtonTitle:@"Ok" otherButtonTitles:nil, nil];
[errorAlertView show];
}
}];
We can check whether user is logged or not with
if ([PFUser currentUser]) {
// user is logged
}
It means PFUser logInWithUsernameInBackground:password: download the user data and store it somewhere in iOS, I don't know whether it is in plist or another file, or maybe session.
Where does Parse Framework store user login session in iOS?