PFUser(Synchronous)

@interface PFUser (Synchronous)

This category lists all methods of PFUser class that are synchronous, but have asynchronous counterpart, Calling one of these synchronous methods could potentially block the current thread for a large amount of time, since it might be fetching from network or saving/loading data from disk.

  • Signs up the user synchronously.

    This will also enforce that the username isn’t already taken.

    Warning

    Make sure that password and username are set before calling this method.

    Declaration

    Objective-C

    - (BOOL)signUp;

    Return Value

    Returns YES if the sign up was successful, otherwise NO.

  • Signs up the user synchronously.

    This will also enforce that the username isn’t already taken.

    Warning

    Make sure that password and username are set before calling this method.

    Declaration

    Objective-C

    - (BOOL)signUp:(NSError *_Nullable *_Nullable)error;

    Parameters

    error

    Error object to set on error.

    Return Value

    Returns whether the sign up was successful.

  • Makes a synchronous request to login a user with specified credentials.

    Returns an instance of the successfully logged in PFUser. This also caches the user locally so that calls to +currentUser will use the latest logged in user.

    Declaration

    Objective-C

    + (nullable instancetype)logInWithUsername:(nonnull NSString *)username
                                      password:(nonnull NSString *)password;

    Parameters

    username

    The username of the user.

    password

    The password of the user.

    Return Value

    Returns an instance of the PFUser on success. If login failed for either wrong password or wrong username, returns nil.

  • Makes a synchronous request to login a user with specified credentials.

    Returns an instance of the successfully logged in PFUser. This also caches the user locally so that calls to +currentUser will use the latest logged in user.

    Declaration

    Objective-C

    + (nullable instancetype)logInWithUsername:(nonnull NSString *)username
                                      password:(nonnull NSString *)password
                                         error:(NSError *_Nullable *_Nullable)error;

    Parameters

    username

    The username of the user.

    password

    The password of the user.

    error

    The error object to set on error.

    Return Value

    Returns an instance of the PFUser on success. If login failed for either wrong password or wrong username, returns nil.

  • Makes a synchronous request to become a user with the given session token.

    Returns an instance of the successfully logged in PFUser. This also caches the user locally so that calls to +currentUser will use the latest logged in user.

    Declaration

    Objective-C

    + (nullable instancetype)become:(nonnull NSString *)sessionToken;

    Parameters

    sessionToken

    The session token for the user.

    Return Value

    Returns an instance of the PFUser on success. If becoming a user fails due to incorrect token, it returns nil.

  • Makes a synchronous request to become a user with the given session token.

    Returns an instance of the successfully logged in PFUser. This will also cache the user locally so that calls to +currentUser will use the latest logged in user.

    Declaration

    Objective-C

    + (nullable instancetype)become:(nonnull NSString *)sessionToken
                              error:(NSError *_Nullable *_Nullable)error;

    Parameters

    sessionToken

    The session token for the user.

    error

    The error object to set on error.

    Return Value

    Returns an instance of the PFUser on success. If becoming a user fails due to incorrect token, it returns nil.

  • Synchronously* logs out the currently logged in user on disk.

    Declaration

    Objective-C

    + (void)logOut;
  • Synchronously Send a password reset request for a specified email.

    If a user account exists with that email, an email will be sent to that address with instructions on how to reset their password.

    Declaration

    Objective-C

    + (BOOL)requestPasswordResetForEmail:(nonnull NSString *)email;

    Parameters

    email

    Email of the account to send a reset password request.

    Return Value

    Returns YES if the reset email request is successful. NO - if no account was found for the email address.

  • Synchronously send a password reset request for a specified email and sets an error object.

    If a user account exists with that email, an email will be sent to that address with instructions on how to reset their password.

    Declaration

    Objective-C

    + (BOOL)requestPasswordResetForEmail:(nonnull NSString *)email
                                   error:(NSError *_Nullable *_Nullable)error;

    Parameters

    email

    Email of the account to send a reset password request.

    error

    Error object to set on error.

    Return Value

    Returns YES if the reset email request is successful. NO - if no account was found for the email address.