3

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?

Edward Anthony
  • 3,354
  • 3
  • 25
  • 40

1 Answers1

4

I had a bit of a poke around an app of mine that uses Parse and found the following.

enter image description here

Inside Library/Private Documents/Parse there is a currentUser file, and this contains the JSON representation of your user.

rickerbh
  • 9,731
  • 1
  • 31
  • 35
  • Have you created a way to access those data? I am particularly interested on the session id. I am moving out of parse server to my own implementation and do not want my users to have to login again. The way I though to do that was by accessing the session id directly and using it to authenticate. – zirinisp Jul 16 '17 at 08:50