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 *email
Declared In
MFUser.h
password
Specifies a secure password for user that used for login credential.
@property (strong, nonatomic, nullable) NSString *password
Declared In
MFUser.h
firstname
Specifies first name of user.
@property (strong, nonatomic, nullable) NSString *firstname
Declared In
MFUser.h
lastname
Specifies last name of user.
@property (strong, nonatomic, nullable) NSString *lastname
Declared In
MFUser.h
data
Specifies all key and value pairs of user data.
@property (strong, nonatomic, readonly, nullable) NSDictionary *data
Declared In
MFUser.h
schema
Specifies a MFDataSchema
object of a user.
@property (strong, nonatomic, readonly, nullable) MFDataSchema *schema
Discussion
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)user
Return 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 *)dictionary
Return 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 *)key
Parameters
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 *)key
Parameters
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 *)key
Parameters
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 *)key
Parameters
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 *)key
Parameters
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 *)key
Parameters
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 *)key
Parameters
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 *)key
Parameters
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 *)key
Parameters
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 *)key
Parameters
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 *)key
Parameters
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 *)key
Parameters
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 *)key
Parameters
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)block
Parameters
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)block
Parameters
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)block
Parameters
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)block
Parameters
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)block
Parameters
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)block
Parameters
oldPassword |
|
---|---|
newPassword |
The new password to set. |
block |
The block to execute. It shoud have the following argument signature: |
Discussion
Declared In
MFUser.h