PFUser Class Reference
| Inherits from | PFObject : NSObject |
| Conforms to | PFSubclassing |
| Declared in | PFUser.h |
Overview
A Parse Framework User Object that is a local representation of a user persisted to the Parse cloud. This class
is a subclass of a PFObject, and retains the same functionality of a PFObject, but also extends it with various
user specific methods, like authentication, signing up, and validation uniqueness.
Many APIs responsible for linking a PFUser with Facebook or Twitter have been deprecated in favor of dedicated
utilities for each social network. See PFFacebookUtils and PFTwitterUtils for more information.
Tasks
Other Methods
-
+ parseClassNameThe name of the PFUser class in the REST API. This is a required
PFSubclassing method
Accessing the Current User
-
+ currentUserGets the currently logged in user from disk and returns an instance of it.
-
sessionTokenThe session token for the PFUser. This is set by the server upon successful authentication.
property -
isNewWhether the PFUser was just created from a request. This is only set after a Facebook or Twitter login.
property -
– isAuthenticatedWhether the user is an authenticated object for the device. An authenticated PFUser is one that is obtained via
a signUp or logIn method. An authenticated object is required in order to save (with altered values) or delete it.
Creating a New User
-
+ userCreates a new PFUser object.
-
+ enableAutomaticUserEnables automatic creation of anonymous users. After calling this method, [PFUser currentUser] will always have a value.
The user will only be created on the server once the user has been saved, or once an object with a relation to that user or
an ACL that refers to the user has been saved. -
usernameThe username for the PFUser.
property -
passwordThe password for the PFUser. This will not be filled in from the server with
property
the password. It is only meant to be set. -
emailThe email for the PFUser.
property -
– signUpSigns up the user. Make sure that password and username are set. This will also enforce that the username isn’t already taken.
-
– signUp:Signs up the user. Make sure that password and username are set. This will also enforce that the username isn’t already taken.
-
– signUpInBackgroundSigns up the user asynchronously. Make sure that password and username are set. This will also enforce that the username isn’t already taken.
-
– signUpInBackgroundWithBlock:Signs up the user asynchronously. Make sure that password and username are set. This will also enforce that the username isn’t already taken.
-
– signUpInBackgroundWithTarget:selector:Signs up the user asynchronously. Make sure that password and username are set. This will also enforce that the username isn’t already taken.
Logging in
-
+ logInWithUsername:password:Makes a request to login a user with specified credentials. Returns an instance
of the successfully logged in PFUser. This will also cache the user locally so
that calls to userFromCurrentUser will use the latest logged in user. -
+ logInWithUsername:password:error:Makes a request to login a user with specified credentials. Returns an
instance of the successfully logged in PFUser. This will also cache the user
locally so that calls to userFromCurrentUser will use the latest logged in user. -
+ logInWithUsernameInBackground:password:Makes an asynchronous request to login a user with specified credentials.
Returns an instance of the successfully logged in PFUser. This will also cache
the user locally so that calls to userFromCurrentUser will use the latest logged in user. -
+ logInWithUsernameInBackground:password:target:selector:Makes an asynchronous request to login a user with specified credentials.
Returns an instance of the successfully logged in PFUser. This will also cache
the user locally so that calls to userFromCurrentUser will use the latest logged in user.
The selector for the callback should look like: myCallback:(PFUser *)user error:(NSError **)error -
+ logInWithUsernameInBackground:password:block:Makes an asynchronous request to log in a user with specified credentials.
Returns an instance of the successfully logged in PFUser. This will also cache
the user locally so that calls to userFromCurrentUser will use the latest logged in user.
Logging Out
Requesting a Password Reset
-
+ requestPasswordResetForEmail: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. -
+ requestPasswordResetForEmail:error: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. -
+ requestPasswordResetForEmailInBackground:Send a password reset request asynchronously 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. -
+ requestPasswordResetForEmailInBackground:target:selector:Send a password reset request asynchronously 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. -
+ requestPasswordResetForEmailInBackground:block:Send a password reset request asynchronously 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.
Querying for Users
-
+ queryCreates a query for PFUser objects.
Properties
The email for the PFUser.
@property (nonatomic, retain) NSString *emailDiscussion
The email for the PFUser.
Declared In
PFUser.hisNew
Whether the PFUser was just created from a request. This is only set after a Facebook or Twitter login.
@property (readonly, assign) BOOL isNewDiscussion
Whether the PFUser was just created from a request. This is only set after a Facebook or Twitter login.
Declared In
PFUser.hpassword
The password for the PFUser. This will not be filled in from the server with
the password. It is only meant to be set.
@property (nonatomic, retain) NSString *passwordDiscussion
The password for the PFUser. This will not be filled in from the server with
the password. It is only meant to be set.
Declared In
PFUser.hClass Methods
currentUser
Gets the currently logged in user from disk and returns an instance of it.
+ (PFUser *)currentUserReturn Value
Returns a PFUser that is the currently logged in user. If there is none, returns nil.
Discussion
Gets the currently logged in user from disk and returns an instance of it.
Declared In
PFUser.henableAutomaticUser
Enables automatic creation of anonymous users. After calling this method, [PFUser currentUser] will always have a value.
The user will only be created on the server once the user has been saved, or once an object with a relation to that user or
an ACL that refers to the user has been saved.
+ (void)enableAutomaticUserDiscussion
Enables automatic creation of anonymous users. After calling this method, [PFUser currentUser] will always have a value.
The user will only be created on the server once the user has been saved, or once an object with a relation to that user or
an ACL that refers to the user has been saved.
Note: saveEventually will not work if an item being saved has a relation to an automatic user that has never been saved.
Declared In
PFUser.hlogInWithUsername:password:
Makes a request to login a user with specified credentials. Returns an instance
of the successfully logged in PFUser. This will also cache the user locally so
that calls to userFromCurrentUser will use the latest logged in user.
+ (PFUser *)logInWithUsername:(NSString *)username password:(NSString *)passwordReturn Value
Returns an instance of the PFUser on success. If login failed for either wrong password or wrong username, returns nil.
Discussion
Makes a request to login a user with specified credentials. Returns an instance
of the successfully logged in PFUser. This will also cache the user locally so
that calls to userFromCurrentUser will use the latest logged in user.
Declared In
PFUser.hlogInWithUsername:password:error:
Makes a request to login a user with specified credentials. Returns an
instance of the successfully logged in PFUser. This will also cache the user
locally so that calls to userFromCurrentUser will use the latest logged in user.
+ (PFUser *)logInWithUsername:(NSString *)username password:(NSString *)password error:(NSError **)errorParameters
- 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.
Discussion
Makes a request to login a user with specified credentials. Returns an
instance of the successfully logged in PFUser. This will also cache the user
locally so that calls to userFromCurrentUser will use the latest logged in user.
Declared In
PFUser.hlogInWithUsernameInBackground:password:
Makes an asynchronous request to login a user with specified credentials.
Returns an instance of the successfully logged in PFUser. This will also cache
the user locally so that calls to userFromCurrentUser will use the latest logged in user.
+ (void)logInWithUsernameInBackground:(NSString *)username password:(NSString *)passwordDiscussion
Makes an asynchronous request to login a user with specified credentials.
Returns an instance of the successfully logged in PFUser. This will also cache
the user locally so that calls to userFromCurrentUser will use the latest logged in user.
Declared In
PFUser.hlogInWithUsernameInBackground:password:block:
Makes an asynchronous request to log in a user with specified credentials.
Returns an instance of the successfully logged in PFUser. This will also cache
the user locally so that calls to userFromCurrentUser will use the latest logged in user.
+ (void)logInWithUsernameInBackground:(NSString *)username password:(NSString *)password block:(PFUserResultBlock)blockParameters
- block
The block to execute. The block should have the following argument signature: (PFUser user, NSError error)
Discussion
Makes an asynchronous request to log in a user with specified credentials.
Returns an instance of the successfully logged in PFUser. This will also cache
the user locally so that calls to userFromCurrentUser will use the latest logged in user.
Declared In
PFUser.hlogInWithUsernameInBackground:password:target:selector:
Makes an asynchronous request to login a user with specified credentials.
Returns an instance of the successfully logged in PFUser. This will also cache
the user locally so that calls to userFromCurrentUser will use the latest logged in user.
The selector for the callback should look like: myCallback:(PFUser *)user error:(NSError **)error
+ (void)logInWithUsernameInBackground:(NSString *)username password:(NSString *)password target:(id)target selector:(SEL)selectorParameters
- target
Target object for the selector.
- selector
The selector that will be called when the asynchrounous request is complete.
Discussion
Makes an asynchronous request to login a user with specified credentials.
Returns an instance of the successfully logged in PFUser. This will also cache
the user locally so that calls to userFromCurrentUser will use the latest logged in user.
The selector for the callback should look like: myCallback:(PFUser *)user error:(NSError **)error
Declared In
PFUser.hlogOut
Logs out the currently logged in user on disk.
+ (void)logOutDiscussion
Logs out the currently logged in user on disk.
Declared In
PFUser.hparseClassName
The name of the PFUser class in the REST API. This is a required
PFSubclassing method
+ (NSString *)parseClassNameDiscussion
The name of the PFUser class in the REST API. This is a required
PFSubclassing method
Declared In
PFUser.hquery
Creates a query for PFUser objects.
+ (PFQuery *)queryDiscussion
Creates a query for PFUser objects.
Declared In
PFUser.hrequestPasswordResetForEmail:
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.
+ (BOOL)requestPasswordResetForEmail:(NSString *)emailParameters
Email of the account to send a reset password request.
Return Value
Returns true if the reset email request is successful. False if no account was found for the email address.
Discussion
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.
Declared In
PFUser.hrequestPasswordResetForEmail:error:
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.
+ (BOOL)requestPasswordResetForEmail:(NSString *)email error:(NSError **)errorParameters
Email of the account to send a reset password request.
- error
Error object to set on error.
Return Value
Returns true if the reset email request is successful. False if no account was found for the email address.
Discussion
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.
Declared In
PFUser.hrequestPasswordResetForEmailInBackground:
Send a password reset request asynchronously 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.
+ (void)requestPasswordResetForEmailInBackground:(NSString *)emailParameters
Email of the account to send a reset password request.
Discussion
Send a password reset request asynchronously 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.
Declared In
PFUser.hrequestPasswordResetForEmailInBackground:block:
Send a password reset request asynchronously 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.
+ (void)requestPasswordResetForEmailInBackground:(NSString *)email block:(PFBooleanResultBlock)blockParameters
Email of the account to send a reset password request.
- block
The block to execute. The block should have the following argument signature: (BOOL succeeded, NSError *error)
Discussion
Send a password reset request asynchronously 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.
Declared In
PFUser.hrequestPasswordResetForEmailInBackground:target:selector:
Send a password reset request asynchronously 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.
+ (void)requestPasswordResetForEmailInBackground:(NSString *)email target:(id)target selector:(SEL)selectorParameters
Email of the account to send a reset password request.
- target
Target object for the selector.
- selector
The selector that will be called when the asynchronous request is complete. It should have the following signature: (void)callbackWithResult:(NSNumber *)result error:(NSError **)error. error will be nil on success and set if there was an error. [result boolValue] will tell you whether the call succeeded or not.
Discussion
Send a password reset request asynchronously 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.
Declared In
PFUser.hInstance Methods
isAuthenticated
Whether the user is an authenticated object for the device. An authenticated PFUser is one that is obtained via
a signUp or logIn method. An authenticated object is required in order to save (with altered values) or delete it.
- (BOOL)isAuthenticatedReturn Value
Returns whether the user is authenticated.
Discussion
Whether the user is an authenticated object for the device. An authenticated PFUser is one that is obtained via
a signUp or logIn method. An authenticated object is required in order to save (with altered values) or delete it.
Declared In
PFUser.hsignUp
Signs up the user. Make sure that password and username are set. This will also enforce that the username isn’t already taken.
- (BOOL)signUpReturn Value
Returns true if the sign up was successful.
Discussion
Signs up the user. Make sure that password and username are set. This will also enforce that the username isn’t already taken.
Declared In
PFUser.hsignUp:
Signs up the user. Make sure that password and username are set. This will also enforce that the username isn’t already taken.
- (BOOL)signUp:(NSError **)errorParameters
- error
Error object to set on error.
Return Value
Returns whether the sign up was successful.
Discussion
Signs up the user. Make sure that password and username are set. This will also enforce that the username isn’t already taken.
Declared In
PFUser.hsignUpInBackground
Signs up the user asynchronously. Make sure that password and username are set. This will also enforce that the username isn’t already taken.
- (void)signUpInBackgroundDiscussion
Signs up the user asynchronously. Make sure that password and username are set. This will also enforce that the username isn’t already taken.
Declared In
PFUser.hsignUpInBackgroundWithBlock:
Signs up the user asynchronously. Make sure that password and username are set. This will also enforce that the username isn’t already taken.
- (void)signUpInBackgroundWithBlock:(PFBooleanResultBlock)blockParameters
- block
The block to execute. The block should have the following argument signature: (BOOL succeeded, NSError *error)
Discussion
Signs up the user asynchronously. Make sure that password and username are set. This will also enforce that the username isn’t already taken.
Declared In
PFUser.hsignUpInBackgroundWithTarget:selector:
Signs up the user asynchronously. Make sure that password and username are set. This will also enforce that the username isn’t already taken.
- (void)signUpInBackgroundWithTarget:(id)target selector:(SEL)selectorParameters
- target
Target object for the selector.
- selector
The selector that will be called when the asynchrounous request is complete. It should have the following signature: (void)callbackWithResult:(NSNumber *)result error:(NSError **)error. error will be nil on success and set if there was an error. [result boolValue] will tell you whether the call succeeded or not.
Discussion
Signs up the user asynchronously. Make sure that password and username are set. This will also enforce that the username isn’t already taken.
Declared In
PFUser.h