MFUser Class Reference
| Inherits from | NSObject |
|---|---|
| Declared in | MFUser.h MFUser.m |
Overview
The MFUser class is a local representation of a user persisted to the Mesosfer Data. This class is an extended of a MFData, and retains the same functionality of a MFData, but also extends it with various user specific methods, like register, login, and validation uniqueness.
email
Specifies a email address for user that used for login credential.
@property (strong, nonatomic, nullable) NSString *emailDeclared In
MFUser.h
password
Specifies a secure password for user that used for login credential.
@property (strong, nonatomic, nullable) NSString *passwordDeclared In
MFUser.h
firstname
Specifies first name of user.
@property (strong, nonatomic, nullable) NSString *firstnameDeclared In
MFUser.h
lastname
Specifies last name of user.
@property (strong, nonatomic, nullable) NSString *lastnameDeclared In
MFUser.h
data
Specifies all key and value pairs of user data.
@property (strong, nonatomic, readonly, nullable) NSDictionary *dataDeclared In
MFUser.h
schema
Specifies a MFDataSchema object of a user.
@property (strong, nonatomic, readonly, nullable) MFDataSchema *schemaDiscussion
This field will be assigned by fetching current object that exists or by saving new user to Mesosfer cloud.
Declared In
MFUser.h
+ user
Creates a new user object.
+ (nonnull instancetype)userReturn Value
A new user object.
See Also
MFUser.- registerAsyncWithBlock:
Declared In
MFUser.h
– dictionary
Gets all key and value pair of MFUser object in a dictionary.
- (nullable NSDictionary *)dictionaryReturn Value
The dictionary of all key and value pair object.
Declared In
MFUser.h
– objectForKey:
Returns the value associated with a given key.
- (nullable id)objectForKey:(nonnull NSString *)keyParameters
key |
The key for which to return the corresponding value. |
|---|
See Also
Declared In
MFUser.h
– objectForKeyedSubscript:
Returns the value associated with a given key.
- (nullable id)objectForKeyedSubscript:(nonnull NSString *)keyParameters
key |
The key for which to return the corresponding value. |
|---|
Discussion
This method enables usage of literal syntax on MFUser.
E.g. NSString *value = user[@"key"];
See Also
Declared In
MFUser.h
– stringForKey:
Returns the NSString value associated with a given key.
- (nullable NSString *)stringForKey:(nonnull NSString *)keyParameters
key |
The key for which to return the corresponding value. |
|---|
Declared In
MFUser.h
– numberForKey:
Returns the NSNumber value associated with a given key.
- (nullable NSNumber *)numberForKey:(nonnull NSString *)keyParameters
key |
The key for which to return the corresponding value. |
|---|
Declared In
MFUser.h
– doubleForKey:
Returns the double value associated with a given key if it exists and is a double or can be coerced to a double, or NAN otherwise.
- (double)doubleForKey:(nonnull NSString *)keyParameters
key |
The key for which to return the corresponding value. |
|---|
Declared In
MFUser.h
– integerForKey:
Returns the int value associated with a given key if it exists and is an int or can be coerced to an int, or 0 otherwise.
- (int)integerForKey:(nonnull NSString *)keyParameters
key |
The key for which to return the corresponding value. |
|---|
Declared In
MFUser.h
– booleanForKey:
Returns the BOOL value associated with a given key.
- (BOOL)booleanForKey:(nonnull NSString *)keyParameters
key |
The key for which to return the corresponding value. |
|---|
Declared In
MFUser.h
– dateForKey:
Returns the NSDate value associated with a given key if it exists and is a NSDate or can be coerced to a NSDate, or nil otherwise.
- (nullable NSDate *)dateForKey:(nonnull NSString *)keyParameters
key |
The key for which to return the corresponding value. |
|---|
Declared In
MFUser.h
– dictionaryForKey:
Returns the NSDictionary value associated with a given key.
- (nullable NSDictionary *)dictionaryForKey:(nonnull NSString *)keyParameters
key |
The key for which to return the corresponding value. |
|---|
Declared In
MFUser.h
– arrayForKey:
Returns the NSArray value associated with a given key.
- (nullable NSArray *)arrayForKey:(nonnull NSString *)keyParameters
key |
The key for which to return the corresponding value. |
|---|
Declared In
MFUser.h
– removeObjectForKey:
Unsets a key on the object.
- (void)removeObjectForKey:(nonnull NSString *)keyParameters
key |
The key. |
|---|
Declared In
MFUser.h
– setObject:forKey:
Sets the object associated with a given key.
- (void)setObject:(nonnull id)object forKey:(nonnull NSString *)keyParameters
object |
The object for |
|---|---|
key |
The key for |
See Also
Declared In
MFUser.h
– setObject:forKeyedSubscript:
Returns the value associated with a given key.
- (void)setObject:(nonnull id)object forKeyedSubscript:(nonnull NSString *)keyParameters
object |
The object for |
|---|---|
key |
The key for |
Discussion
This method enables usage of literal syntax on MFUser. E.g. user[@"key"] = @"value";
See Also
Declared In
MFUser.h
– registerAsyncWithBlock:
Register new user asynchronously.
- (void)registerAsyncWithBlock:(nullable MFBooleanResultBlock)blockParameters
block |
The block to execute. It should have the following argument signature: |
|---|
Discussion
This will also enforce that the email address isn’t already taken.
Declared In
MFUser.h
+ logInAsyncWithEmail:password:block:
Makes an asynchronous request to log in a user with specified credentials.
+ (void)logInAsyncWithEmail:(nonnull NSString *)email password:(nonnull NSString *)password block:(nullable MFUserResultBlock)blockParameters
email |
|
|---|---|
password |
|
block |
The block to execute. It should have the following argument signature: |
Discussion
Returns an instance of the successfully logged in MFUser.
This also caches the user locally so that calls to currentUser will use the latest logged in user.
Declared In
MFUser.h
+ logOutAsyncWithBlock:
Asynchronously logs out the currently logged in user.
+ (void)logOutAsyncWithBlock:(nullable MFUserLogoutResultBlock)blockParameters
block |
A block that will be called when logging out completes or fails. |
|---|
Discussion
This will also remove the session from disk, log out of linked services and all future calls to currentUser will return nil.
Declared In
MFUser.h
– saveAsyncWithBlock:
Saves the MFUser asynchronously and executes the given callback block.
- (void)saveAsyncWithBlock:(nullable MFBooleanResultBlock)blockParameters
block |
The block to execute. It should have the following argument signature: |
|---|
Declared In
MFUser.h
– fetchAsyncWithBlock:
Fetch the current MFUser data from Mesosfer cloud asynchronously and executes the given callback block.
- (void)fetchAsyncWithBlock:(nullable MFUserResultBlock)blockParameters
block |
The block to execute. It shoud have the following argument signature: |
|---|
Discussion
Declared In
MFUser.h
– changePasswordAsyncWithOldPassword:newPassword:block:
Changes the current MFUser password on Mesosfer cloud asynchronously and executes the given callback block.
- (void)changePasswordAsyncWithOldPassword:(nonnull NSString *)oldPassword newPassword:(nonnull NSString *)newPassword block:(nullable MFBooleanResultBlock)blockParameters
oldPassword |
|
|---|---|
newPassword |
The new password to set. |
block |
The block to execute. It shoud have the following argument signature: |
Discussion
Declared In
MFUser.h