NMUser Class Reference
| Inherits from | NMCore : NSObject |
| Declared in | NMUser.h NMUser.m |
Overview
The NMUser class is used to perform regarding operations in order to create a user management system in the application. Registering, updating and logging users are the operations performed over NMUser instances. All registered users are stored over cloud.
Tasks
-
emailEmail address of the registered user.
property -
passwordPassword of the registered user.
property -
nicknameNickname of the registered user.
property -
nameName of the registered user.
property -
surnameSurname of the registered user.
property -
facebookIdIdentifier given by Facebook when logging on the user with a Facebook account.
property -
twitterUserNameIdentifier given by Twitter when logging on the user with a Twitter account.
property -
customDictionaryCustom key-value pairs assigned to the registered user.
property -
activeLoginTypeEnum type which indicates how the user login into the application.
property -
isNewUserThe boolean value which shows whether the user is a newly-registered or not.
property -
isGeneratedMailThe boolean value which shows whether the email of the user is generated by the system or not.
property -
+ getCurrentUserReturns the current logged user.
-
– registerWithError:Registers a new user to the application. Email, password and nickname properties must be set on the user because they are required fields; otherwise, name, surname and customDictionary properties are optional.
-
– registerInBackgroundWithCompletionHandler:Registers a new user to the application on the background thread. Email, password and nickname properties must be set on the user because they are required fields; otherwise, name, surname and customDictionary properties are optional.
-
– update:Updates a registered user. Only the properties on the caller NMUser object are updated. All properties except email can be updated.
-
– updateWithError:Updates a registered user. Only the properties on the caller NMUser object are updated. All properties except email can be updated.
-
– updateInBackgroundWithCompletionHandler:Updates a registered user on the background thread. Only the properties on the caller NMUser object are updated. All properties except email can be updated.
-
+ loginWithEmail:password:error:Logs on a user with email for the application.
-
+ loginInBackgroundWithEmail:password:completionHandler:Logs on a user with email for the application on the background thread.
-
+ loginAsGuestWithError:Logs on a guest user for the application. Guest user means a user with no property set.
-
+ loginAsGuestInBackgroundWithCompletionHandler:Logs on a guest user for the application on the background thread. Guest user means a user with no property set.
-
+ logoutLogs the user out of the application.
-
+ activateUserWithEmail:andError:Activates login operation for a registered user.
-
+ deactivateUserWithEmail:andError:Deactivates login operation for a registered user.
Properties
activeLoginType
Enum type which indicates how the user login into the application.
@property (nonatomic, readonly, assign) NMLoginType activeLoginTypeDiscussion
Enum type which indicates how the user login into the application.
Warning: Available enum options for LoginType
NMLoginTypeNone, user does not login yet.
NMLoginTypeFacebook, user logins with a Facebook account.
NMLoginTypeTwitter, user logins with a Twitter account.
NMLoginTypeEmail, user logins with an email account.
NMLoginTypeGuest, user logins as guest.
Declared In
NMUser.hcustomDictionary
Custom key-value pairs assigned to the registered user.
@property (nonatomic, strong) NSMutableDictionary *customDictionaryDiscussion
Custom key-value pairs assigned to the registered user.
The value on the user is overridden every time newly-created customDictionary property is sent with any request.
Declared In
NMUser.hEmail address of the registered user.
@property (nonatomic, strong) NSString *emailDiscussion
Email address of the registered user.
Declared In
NMUser.hfacebookId
Identifier given by Facebook when logging on the user with a Facebook account.
@property (nonatomic, strong) NSString *facebookIdDiscussion
Identifier given by Facebook when logging on the user with a Facebook account.
Declared In
NMUser.hisGeneratedMail
The boolean value which shows whether the email of the user is generated by the system or not.
@property BOOL isGeneratedMailDiscussion
The boolean value which shows whether the email of the user is generated by the system or not.
Declared In
NMUser.hisNewUser
The boolean value which shows whether the user is a newly-registered or not.
@property BOOL isNewUserDiscussion
The boolean value which shows whether the user is a newly-registered or not.
Declared In
NMUser.hname
Name of the registered user.
@property (nonatomic, strong) NSString *nameDiscussion
Name of the registered user.
Declared In
NMUser.hnickname
Nickname of the registered user.
@property (nonatomic, strong) NSString *nicknameDiscussion
Nickname of the registered user.
Declared In
NMUser.hpassword
Password of the registered user.
@property (nonatomic, strong) NSString *passwordDiscussion
Password of the registered user.
Declared In
NMUser.hClass Methods
activateUserWithEmail:andError:
Activates login operation for a registered user.
+ (BOOL)activateUserWithEmail:(NSString *)email andError:(NSError **)errorParameters
Email address of the registered user.
- error
On input, a pointer to an error object. If an error occurs, this pointer is set to an actual error object containing the error information. You may specify nil for this parameter if you do not want the error information.
Return Value
YES if the user is activated succesfully. Returns NO if an error occurs.
Discussion
Activates login operation for a registered user.
When a newly-created user is registered to the application, it is activated automatically.
Declared In
NMUser.hdeactivateUserWithEmail:andError:
Deactivates login operation for a registered user.
+ (BOOL)deactivateUserWithEmail:(NSString *)email andError:(NSError **)errorParameters
Email address of the registered user.
- error
On input, a pointer to an error object. If an error occurs, this pointer is set to an actual error object containing the error information. You may specify nil for this parameter if you do not want the error information.
Return Value
YES if the user is deactivated succesfully. Returns NO if an error occurs.
Discussion
Deactivates login operation for a registered user.
Declared In
NMUser.hgetCurrentUser
Returns the current logged user.
+ (NMUser *)getCurrentUserReturn Value
Current logged user in the application. Returns nil if there is no logged user.
Discussion
Returns the current logged user.
Declared In
NMUser.hloginAsGuestInBackgroundWithCompletionHandler:
Logs on a guest user for the application on the background thread. Guest user means a user with no property set.
+ (void)loginAsGuestInBackgroundWithCompletionHandler:(void ( ^ ) ( NMUser *user , NSError *error ))handlerParameters
- handler
The block to execute when the login of the user is completed.
Discussion
Logs on a guest user for the application on the background thread. Guest user means a user with no property set.
The logged user is saved in cache until calling logout method. As background methods does not block your main thread, it is recommended to use loginAsGuestInBackgroundWithCompletionHandler: over loginAsGuestWithError:.
Declared In
NMUser.hloginAsGuestWithError:
Logs on a guest user for the application. Guest user means a user with no property set.
+ (NMUser *)loginAsGuestWithError:(NSError **)errorParameters
- error
On input, a pointer to an error object. If an error occurs, this pointer is set to an actual error object containing the error information. You may specify nil for this parameter if you do not want the error information.
Return Value
Logged guest NMUser object if login is completed succesfully. Returns NO if an error occurs.
Discussion
Logs on a guest user for the application. Guest user means a user with no property set.
The logged user is saved in cache until calling logout method.
Declared In
NMUser.hloginInBackgroundWithEmail:password:completionHandler:
Logs on a user with email for the application on the background thread.
+ (void)loginInBackgroundWithEmail:(NSString *)email password:(NSString *)password completionHandler:(void ( ^ ) ( NMUser *user , NSError *error ))handlerParameters
Email address of the registered user.
- password
Password of the registered user.
- handler
The block to execute when the login of the user is completed.
Discussion
Logs on a user with email for the application on the background thread.
The logged user is saved in cache until calling logout method. As background methods does not block your main thread, it is recommended to use loginInBackgroundWithEmail:password:completionHandler: over loginWithEmail:password:error:.
Declared In
NMUser.hloginWithEmail:password:error:
Logs on a user with email for the application.
+ (NMUser *)loginWithEmail:(NSString *)email password:(NSString *)password error:(NSError **)errorParameters
Email address of the registered user.
- password
Password of the registered user.
- error
On input, a pointer to an error object. If an error occurs, this pointer is set to an actual error object containing the error information. You may specify nil for this parameter if you do not want the error information.
Return Value
Logged NMUser object if login is completed succesfully. Returns NO if an error occurs.
Discussion
Logs on a user with email for the application.
The logged user is saved in cache until calling logout method.
Declared In
NMUser.hInstance Methods
registerInBackgroundWithCompletionHandler:
Registers a new user to the application on the background thread. Email, password and nickname properties must be set on the user because they are required fields; otherwise, name, surname and customDictionary properties are optional.
- (void)registerInBackgroundWithCompletionHandler:(void ( ^ ) ( NSError *error ))handlerParameters
- handler
The block to execute when the registration of the user is completed.
Discussion
Registers a new user to the application on the background thread. Email, password and nickname properties must be set on the user because they are required fields; otherwise, name, surname and customDictionary properties are optional.
Rest of properties except the ones mentioned above should not be set. They will be set automatically after calling the relevant method. As background methods does not block your main thread, it is recommended to use registerInBackgroundWithCompletionHandler: over registerWithError:.
Declared In
NMUser.hregisterWithError:
Registers a new user to the application. Email, password and nickname properties must be set on the user because they are required fields; otherwise, name, surname and customDictionary properties are optional.
- (BOOL)registerWithError:(NSError **)errorParameters
- error
On input, a pointer to an error object. If an error occurs, this pointer is set to an actual error object containing the error information. You may specify nil for this parameter if you do not want the error information.
Return Value
YES if the user is registered succesfully. Returns NO if an error occurs.
Discussion
Registers a new user to the application. Email, password and nickname properties must be set on the user because they are required fields; otherwise, name, surname and customDictionary properties are optional.
Rest of properties except the ones mentioned above should not be set. They will be set automatically after calling the relevant method.
Declared In
NMUser.hupdate:
Updates a registered user. Only the properties on the caller NMUser object are updated. All properties except email can be updated.
- (BOOL)update:(NSError **)errorParameters
- error
On input, a pointer to an error object. If an error occurs, this pointer is set to an actual error object containing the error information. You may specify nil for this parameter if you do not want the error information.
Return Value
YES if the user is updated succesfully. Returns NO if an error occurs.
Discussion
Updates a registered user. Only the properties on the caller NMUser object are updated. All properties except email can be updated.
Declared In
NMUser.hupdateInBackgroundWithCompletionHandler:
Updates a registered user on the background thread. Only the properties on the caller NMUser object are updated. All properties except email can be updated.
- (void)updateInBackgroundWithCompletionHandler:(void ( ^ ) ( NSError *error ))handlerParameters
- handler
The block to execute when the update of the user is completed.
Discussion
Updates a registered user on the background thread. Only the properties on the caller NMUser object are updated. All properties except email can be updated.
As background methods does not block your main thread, it is recommended to use updateInBackgroundWithCompletionHandler: over updateWithError: or update:.
Declared In
NMUser.hupdateWithError:
Updates a registered user. Only the properties on the caller NMUser object are updated. All properties except email can be updated.
- (BOOL)updateWithError:(NSError **)errorParameters
- error
On input, a pointer to an error object. If an error occurs, this pointer is set to an actual error object containing the error information. You may specify nil for this parameter if you do not want the error information.
Return Value
YES if the user is updated succesfully. Returns NO if an error occurs.
Discussion
Updates a registered user. Only the properties on the caller NMUser object are updated. All properties except email can be updated.
Declared In
NMUser.h