AVUser Class Reference
Inherits from | AVObject : NSObject |
---|---|
Conforms to | AVSubclassing |
Declared in | AVUser.h |
Overview
A LeanCloud Framework User Object that is a local representation of a user persisted to the LeanCloud. This class is a subclass of a AVObject, and retains the same functionality of a AVObject, but also extends it with various user specific methods, like authentication, signing up, and validation uniqueness.
Many APIs responsible for linking a AVUser with Facebook or Twitter have been deprecated in favor of dedicated utilities for each social network. See AVFacebookUtils and AVTwitterUtils for more information.
用户好友关系
Accessing the Current User
+ currentUser
Gets the currently logged in user from disk and returns an instance of it.
+ (instancetype _Nullable)currentUser
Return Value
a AVUser 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
AVUser.h
sessionToken
The session token for the AVUser. This is set by the server upon successful authentication.
@property (nonatomic, copy, nullable) NSString *sessionToken
Discussion
The session token for the AVUser. This is set by the server upon successful authentication.
Declared In
AVUser.h
isNew
Whether the AVUser was just created from a request. This is only set after a Facebook or Twitter login.
@property (nonatomic, assign, readonly) BOOL isNew
Discussion
Whether the AVUser was just created from a request. This is only set after a Facebook or Twitter login.
Declared In
AVUser.h
– isAuthenticatedWithSessionToken:callback:
Whether the user is an authenticated object with the given sessionToken.
- (void)isAuthenticatedWithSessionToken:(NSString *)sessionToken callback:(AVBooleanResultBlock)callback
Discussion
Whether the user is an authenticated object with the given sessionToken.
Declared In
AVUser.h
Creating a New User
+ user
Creates a new AVUser object.
+ (instancetype)user
Return Value
a new AVUser object.
Discussion
Creates a new AVUser object.
Declared In
AVUser.h
+ enableAutomaticUser
Enables automatic creation of anonymous users. After calling this method, [AVUser 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)enableAutomaticUser
Discussion
Enables automatic creation of anonymous users. After calling this method, [AVUser 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
AVUser.h
username
The username for the AVUser.
@property (nonatomic, copy, nullable) NSString *username
Discussion
The username for the AVUser.
Declared In
AVUser.h
password
The password for the AVUser. This will not be filled in from the server with the password. It is only meant to be set.
@property (nonatomic, copy, nullable) NSString *password
Discussion
The password for the AVUser. This will not be filled in from the server with the password. It is only meant to be set.
Declared In
AVUser.h
email
Email of the user. If enable “Enable Email Verification” option in the console, when register a user, will send a verification email to the user. Otherwise, only save the email to the server.
@property (nonatomic, copy, nullable) NSString *email
Discussion
Email of the user. If enable “Enable Email Verification” option in the console, when register a user, will send a verification email to the user. Otherwise, only save the email to the server.
Declared In
AVUser.h
mobilePhoneNumber
Mobile phone number of the user. Can be set when registering. If enable the “Enable Mobile Phone Number Verification” option in the console, when register a user, will send an sms message to the phone. Otherwise, only save the mobile phone number to the server.
@property (nonatomic, copy, nullable) NSString *mobilePhoneNumber
Discussion
Mobile phone number of the user. Can be set when registering. If enable the “Enable Mobile Phone Number Verification” option in the console, when register a user, will send an sms message to the phone. Otherwise, only save the mobile phone number to the server.
Declared In
AVUser.h
mobilePhoneVerified
Mobile phone number verification flag. Read-only. if calling verifyMobilePhone:withBlock: succeeds, the server will set this value YES.
@property (nonatomic, assign, readonly) BOOL mobilePhoneVerified
Discussion
Mobile phone number verification flag. Read-only. if calling verifyMobilePhone:withBlock: succeeds, the server will set this value YES.
Declared In
AVUser.h
+ requestEmailVerify:withBlock:
请求重发验证邮件 如果用户邮箱没有得到验证或者用户修改了邮箱, 通过本方法重新发送验证邮件.
+ (void)requestEmailVerify:(NSString *)email withBlock:(AVBooleanResultBlock)block
Parameters
email |
邮件地址 |
---|---|
block |
回调结果 |
Discussion
请求重发验证邮件 如果用户邮箱没有得到验证或者用户修改了邮箱, 通过本方法重新发送验证邮件.
Warning: 为防止滥用,同一个邮件地址,1分钟内只能发1次!
Declared In
AVUser.h
+ requestMobilePhoneVerify:withBlock:
请求手机号码验证 发送短信到指定的手机上,内容有6位数字验证码。验证码10分钟内有效。
+ (void)requestMobilePhoneVerify:(NSString *)phoneNumber withBlock:(AVBooleanResultBlock)block
Parameters
phoneNumber |
11位电话号码 |
---|---|
block |
回调结果 |
Discussion
请求手机号码验证 发送短信到指定的手机上,内容有6位数字验证码。验证码10分钟内有效。
Warning: 对同一个手机号码,每天有 5 条数量的限制,并且发送间隔需要控制在一分钟。
Declared In
AVUser.h
+ requestVerificationCodeForPhoneNumber:options:callback:
Request a verification code for a phone number.
+ (void)requestVerificationCodeForPhoneNumber:(NSString *)phoneNumber options:(nullable AVUserShortMessageRequestOptions *)options callback:(AVBooleanResultBlock)callback
Parameters
phoneNumber |
The phone number that will be verified later. |
---|---|
options |
The short message request options. |
callback |
The callback of request. |
Discussion
Request a verification code for a phone number.
Declared In
AVUser.h
+ verifyMobilePhone:withBlock:
验证手机验证码 发送验证码给服务器进行验证。
+ (void)verifyMobilePhone:(NSString *)code withBlock:(AVBooleanResultBlock)block
Parameters
code |
6位手机验证码 |
---|---|
block |
回调结果 |
Discussion
验证手机验证码 发送验证码给服务器进行验证。
Declared In
AVUser.h
– getRoles:
Get roles which current user belongs to.
- (nullable NSArray<AVRole*> *)getRoles:(NSError **)error
Parameters
error |
The error of request, or nil if request did succeed. |
---|
Return Value
An array of roles, or nil if some error occured.
Discussion
Get roles which current user belongs to.
Declared In
AVUser.h
– getRolesAndThrowsWithError:
An alias of [AVUser getRolesAndThrowsWithError:]
methods that supports Swift exception.
@seealso [AVUser getRolesAndThrowsWithError:]
- (nullable NSArray<AVRole*> *)getRolesAndThrowsWithError:(NSError **)error
Discussion
An alias of [AVUser getRolesAndThrowsWithError:]
methods that supports Swift exception.
@seealso [AVUser getRolesAndThrowsWithError:]
Declared In
AVUser.h
– getRolesInBackgroundWithBlock:
Asynchronously get roles which current user belongs to.
- (void)getRolesInBackgroundWithBlock:(void ( ^ ) ( NSArray<AVRole*> *_Nullable objects , NSError *_Nullable error ))block
Parameters
block |
The callback for request. |
---|
Discussion
Asynchronously get roles which current user belongs to.
Declared In
AVUser.h
– signUp:
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 **)error
Parameters
error |
Error object to set on error. |
---|
Return Value
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
AVUser.h
– signUpAndThrowsWithError:
An alias of [AVUser signUp:]
methods that supports Swift exception.
@seealso [AVUser signUp:]
- (BOOL)signUpAndThrowsWithError:(NSError **)error
Discussion
An alias of [AVUser signUp:]
methods that supports Swift exception.
@seealso [AVUser signUp:]
Declared In
AVUser.h
– 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.
- (void)signUpInBackgroundWithBlock:(AVBooleanResultBlock)block
Parameters
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
AVUser.h
– updatePassword:newPassword:block:
用旧密码来更新密码。在 3.1.6 之后,更新密码成功之后不再需要强制用户重新登录,仍然保持登录状态。
- (void)updatePassword:(NSString *)oldPassword newPassword:(NSString *)newPassword block:(AVIdResultBlock)block
Parameters
oldPassword |
旧密码 |
---|---|
newPassword |
新密码 |
block |
完成时的回调,有以下签名 (id object, NSError *error) |
Discussion
用旧密码来更新密码。在 3.1.6 之后,更新密码成功之后不再需要强制用户重新登录,仍然保持登录状态。
Warning: 此用户必须登录且同时提供了新旧密码,否则不能更新成功。
Declared In
AVUser.h
+ logInWithUsername:password:error:
Makes a request to login a user with specified credentials. Returns an instance of the successfully logged in AVUser. This will also cache the user locally so that calls to userFromCurrentUser will use the latest logged in user.
+ (nullable instancetype)logInWithUsername:(NSString *)username password:(NSString *)password error:(NSError **)error
Parameters
username |
|
---|---|
password |
|
error |
The error object to set on error. |
Return Value
an instance of the AVUser 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 AVUser. This will also cache the user locally so that calls to userFromCurrentUser will use the latest logged in user.
Declared In
AVUser.h
+ logInWithUsernameInBackground:password:block:
Makes an asynchronous request to log in a user with specified credentials. Returns an instance of the successfully logged in AVUser. 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:(AVUserResultBlock)block
Parameters
username |
|
---|---|
password |
|
block |
The block to execute. The block should have the following argument signature: (AVUser user, NSError error) |
Discussion
Makes an asynchronous request to log in a user with specified credentials. Returns an instance of the successfully logged in AVUser. This will also cache the user locally so that calls to userFromCurrentUser will use the latest logged in user.
Declared In
AVUser.h
+ logInWithMobilePhoneNumber:password:error:
使用手机号码和密码登录
+ (nullable instancetype)logInWithMobilePhoneNumber:(NSString *)phoneNumber password:(NSString *)password error:(NSError **)error
Parameters
phoneNumber |
11位电话号码 |
---|---|
password |
密码 |
error |
发生错误通过此参数返回 |
Discussion
使用手机号码和密码登录
Declared In
AVUser.h
+ logInWithMobilePhoneNumberInBackground:password:block:
使用手机号码和密码登录
+ (void)logInWithMobilePhoneNumberInBackground:(NSString *)phoneNumber password:(NSString *)password block:(AVUserResultBlock)block
Parameters
phoneNumber |
11位电话号码 |
---|---|
password |
密码 |
block |
回调结果 |
Discussion
使用手机号码和密码登录
Declared In
AVUser.h
+ requestLoginSmsCode:withBlock:
请求登录码验证 发送短信到指定的手机上,内容有6位数字验证码。验证码10分钟内有效。
+ (void)requestLoginSmsCode:(NSString *)phoneNumber withBlock:(AVBooleanResultBlock)block
Parameters
phoneNumber |
11位电话号码 |
---|---|
block |
回调结果 |
Discussion
请求登录码验证 发送短信到指定的手机上,内容有6位数字验证码。验证码10分钟内有效。
Declared In
AVUser.h
+ requestLoginCodeForPhoneNumber:options:callback:
Request a login code for a phone number.
+ (void)requestLoginCodeForPhoneNumber:(NSString *)phoneNumber options:(nullable AVUserShortMessageRequestOptions *)options callback:(AVBooleanResultBlock)callback
Parameters
phoneNumber |
The phone number of an user who will login later. |
---|---|
options |
The short message request options. |
callback |
The callback of request. |
Discussion
Request a login code for a phone number.
Declared In
AVUser.h
+ logInWithMobilePhoneNumber:smsCode:error:
使用手机号码和验证码登录
+ (nullable instancetype)logInWithMobilePhoneNumber:(NSString *)phoneNumber smsCode:(NSString *)code error:(NSError **)error
Parameters
phoneNumber |
11位电话号码 |
---|---|
code |
6位验证码 |
error |
发生错误通过此参数返回 |
Discussion
使用手机号码和验证码登录
Declared In
AVUser.h
+ logInWithMobilePhoneNumberInBackground:smsCode:block:
使用手机号码和验证码登录
+ (void)logInWithMobilePhoneNumberInBackground:(NSString *)phoneNumber smsCode:(NSString *)code block:(AVUserResultBlock)block
Parameters
phoneNumber |
11位电话号码 |
---|---|
code |
6位验证码 |
block |
回调结果 |
Discussion
使用手机号码和验证码登录
Declared In
AVUser.h
+ signUpOrLoginWithMobilePhoneNumber:smsCode:error:
使用手机号码和验证码注册或登录 用于手机号直接注册用户,需要使用 [AVOSCloud requestSmsCodeWithPhoneNumber:callback:] 获取验证码
+ (nullable instancetype)signUpOrLoginWithMobilePhoneNumber:(NSString *)phoneNumber smsCode:(NSString *)code error:(NSError **)error
Parameters
phoneNumber |
11位电话号码 |
---|---|
code |
6位验证码 |
error |
发生错误通过此参数返回 |
Discussion
使用手机号码和验证码注册或登录 用于手机号直接注册用户,需要使用 [AVOSCloud requestSmsCodeWithPhoneNumber:callback:] 获取验证码
Declared In
AVUser.h
+ signUpOrLoginWithMobilePhoneNumberInBackground:smsCode:block:
使用手机号码和验证码注册或登录 用于手机号直接注册用户,需要使用 [AVOSCloud requestSmsCodeWithPhoneNumber:callback:] 获取验证码
+ (void)signUpOrLoginWithMobilePhoneNumberInBackground:(NSString *)phoneNumber smsCode:(NSString *)code block:(AVUserResultBlock)block
Parameters
phoneNumber |
11位电话号码 |
---|---|
code |
6位验证码 |
block |
回调结果 |
Discussion
使用手机号码和验证码注册或登录 用于手机号直接注册用户,需要使用 [AVOSCloud requestSmsCodeWithPhoneNumber:callback:] 获取验证码
Declared In
AVUser.h
+ signUpOrLoginWithMobilePhoneNumberInBackground:smsCode:password:block:
Use mobile phone number & SMS code & password to sign up or login.
+ (void)signUpOrLoginWithMobilePhoneNumberInBackground:(NSString *)phoneNumber smsCode:(NSString *)smsCode password:(NSString *)password block:(AVUserResultBlock)block
Parameters
phoneNumber |
Phone number. |
---|---|
smsCode |
SMS code. |
password |
Password. |
block |
Result callback. |
Discussion
Use mobile phone number & SMS code & password to sign up or login.
Declared In
AVUser.h
Logging Out
Requesting a Password Reset
+ 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.
+ (BOOL)requestPasswordResetForEmail:(NSString *)email error:(NSError **)error
Parameters
email |
Email of the account to send a reset password request. |
---|---|
error |
Error object to set on error. |
Return Value
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
AVUser.h
+ 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.
+ (void)requestPasswordResetForEmailInBackground:(NSString *)email block:(AVBooleanResultBlock)block
Parameters
email |
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
AVUser.h
+ requestPasswordResetWithPhoneNumber:block:
使用手机号请求密码重置,需要用户绑定手机号码 发送短信到指定的手机上,内容有6位数字验证码。验证码10分钟内有效。
+ (void)requestPasswordResetWithPhoneNumber:(NSString *)phoneNumber block:(AVBooleanResultBlock)block
Parameters
phoneNumber |
11位电话号码 |
---|---|
block |
回调结果 |
Discussion
使用手机号请求密码重置,需要用户绑定手机号码 发送短信到指定的手机上,内容有6位数字验证码。验证码10分钟内有效。
Declared In
AVUser.h
+ requestPasswordResetCodeForPhoneNumber:options:callback:
Request a password reset code for a phone number.
+ (void)requestPasswordResetCodeForPhoneNumber:(NSString *)phoneNumber options:(nullable AVUserShortMessageRequestOptions *)options callback:(AVBooleanResultBlock)callback
Parameters
phoneNumber |
|
---|---|
options |
The short message request options. |
callback |
The callback of request. |
Discussion
Request a password reset code for a phone number.
Declared In
AVUser.h
+ resetPasswordWithSmsCode:newPassword:block:
使用验证码重置密码
+ (void)resetPasswordWithSmsCode:(NSString *)code newPassword:(NSString *)password block:(AVBooleanResultBlock)block
Parameters
code |
6位验证码 |
---|---|
password |
新密码 |
block |
回调结果 |
Discussion
使用验证码重置密码
Declared In
AVUser.h
+ becomeWithSessionTokenInBackground:block:
用 sessionToken 来登录用户
+ (void)becomeWithSessionTokenInBackground:(NSString *)sessionToken block:(AVUserResultBlock)block
Parameters
sessionToken |
|
---|---|
block |
回调结果 |
Discussion
用 sessionToken 来登录用户
Declared In
AVUser.h
+ becomeWithSessionToken:error:
用 sessionToken 来登录用户
+ (nullable instancetype)becomeWithSessionToken:(NSString *)sessionToken error:(NSError **)error
Parameters
sessionToken |
|
---|---|
error |
回调错误 |
Return Value
登录的用户对象
Discussion
用 sessionToken 来登录用户
Declared In
AVUser.h
Querying for Users
+ query
Creates a query for AVUser objects.
+ (AVQuery *)query
Discussion
Creates a query for AVUser objects.
Declared In
AVUser.h
– loginWithAuthData:platformId:options:callback:
Login use auth data.
- (void)loginWithAuthData:(NSDictionary *)authData platformId:(NSString *)platformId options:(AVUserAuthDataLoginOption *_Nullable)options callback:(void ( ^ ) ( BOOL succeeded , NSError *_Nullable error ))callback
Parameters
authData |
Get from third platform, data format e.g. { “id” : “id_string”, “access_token” : “access_token_string”, … … }. |
---|---|
platformId |
The key for the auth data, to identify auth data. |
options |
|
callback |
Result callback. |
Discussion
Login use auth data.
Declared In
AVUser.h
– associateWithAuthData:platformId:options:callback:
Associate auth data to the AVUser instance.
- (void)associateWithAuthData:(NSDictionary *)authData platformId:(NSString *)platformId options:(AVUserAuthDataLoginOption *_Nullable)options callback:(void ( ^ ) ( BOOL succeeded , NSError *_Nullable error ))callback
Parameters
authData |
Get from third platform, data format e.g. { “id” : “id_string”, “access_token” : “access_token_string”, … … }. |
---|---|
platformId |
The key for the auth data, to identify auth data. |
options |
|
callback |
Result callback. |
Discussion
Associate auth data to the AVUser instance.
Declared In
AVUser.h
– disassociateWithPlatformId:callback:
Disassociate auth data from the AVUser instance.
- (void)disassociateWithPlatformId:(NSString *)platformId callback:(void ( ^ ) ( BOOL succeeded , NSError *_Nullable error ))callback
Parameters
platformId |
The key for the auth data, to identify auth data. |
---|---|
callback |
Result callback. |
Discussion
Disassociate auth data from the AVUser instance.
Declared In
AVUser.h
Friendship Methods
– follow:andCallback:
通过ID来关注其他用户
- (void)follow:(NSString *)userId andCallback:(AVBooleanResultBlock)callback
Parameters
userId |
要关注的用户objectId |
---|---|
callback |
回调结果 |
Declared In
AVStatus.h
– follow:userDictionary:andCallback:
通过ID来关注其他用户
- (void)follow:(NSString *)userId userDictionary:(nullable NSDictionary *)dictionary andCallback:(AVBooleanResultBlock)callback
Parameters
userId |
要关注的用户objectId |
---|---|
dictionary |
添加的自定义属性 |
callback |
回调结果 |
Declared In
AVStatus.h
– unfollow:andCallback:
通过ID来取消关注其他用户
- (void)unfollow:(NSString *)userId andCallback:(AVBooleanResultBlock)callback
Parameters
userId |
要取消关注的用户objectId |
---|---|
callback |
回调结果 |
Discussion
通过ID来取消关注其他用户
Declared In
AVStatus.h
– getFollowers:
获取当前用户粉丝的列表
- (void)getFollowers:(AVArrayResultBlock)callback
Parameters
callback |
回调结果 |
---|
Discussion
获取当前用户粉丝的列表
Declared In
AVStatus.h
– getFollowees:
获取当前用户所关注的列表
- (void)getFollowees:(AVArrayResultBlock)callback
Parameters
callback |
回调结果 |
---|
Discussion
获取当前用户所关注的列表
Declared In
AVStatus.h
– getFollowersAndFollowees:
同时获取当前用户的粉丝和关注列表
- (void)getFollowersAndFollowees:(AVDictionaryResultBlock)callback
Parameters
callback |
回调结果, 列表字典包含 |
---|
Discussion
同时获取当前用户的粉丝和关注列表
Declared In
AVStatus.h
Deprecated Methods
+ loginOrSignUpWithAuthData:platform:block:
Use a SNS’s auth data to login or signup. if the auth data already bind to a valid AVUser, then the instance of the AVUser will return in result block. if the auth data not bind to a exist AVUser, then a new instance of AVUser will be created and return in result block.
+ (void)loginOrSignUpWithAuthData:(NSDictionary *)authData platform:(NSString *)platform block:(AVUserResultBlock)block
Parameters
authData |
a Dictionary with specific format. e.g. { “authData” : { ‘platform’ : { ‘uid’ : someChars, ‘access_token’ : someChars, … … (other attribute) } } } |
---|---|
platform |
if the auth data belongs to Weibo, QQ or Weixin(Wechat),
please use |
block |
result callback. |
Discussion
Use a SNS’s auth data to login or signup. if the auth data already bind to a valid AVUser, then the instance of the AVUser will return in result block. if the auth data not bind to a exist AVUser, then a new instance of AVUser will be created and return in result block.
Declared In
AVUser.h
– associateWithAuthData:platform:block:
Associate a SNS’s auth data to a instance of AVUser. after associated, user can login by auth data.
- (void)associateWithAuthData:(NSDictionary *)authData platform:(NSString *)platform block:(AVUserResultBlock)block
Parameters
authData |
a Dictionary with specific format. e.g. { “authData” : { ‘platform’ : { ‘uid’ : someChars, ‘access_token’ : someChars, … … (other attribute) } } } |
---|---|
platform |
if the auth data belongs to Weibo, QQ or Weixin(Wechat),
please use |
block |
result callback. |
Discussion
Associate a SNS’s auth data to a instance of AVUser. after associated, user can login by auth data.
Declared In
AVUser.h
– disassociateWithPlatform:block:
Disassociate the specified platform’s auth data from a instance of AVUser.
- (void)disassociateWithPlatform:(NSString *)platform block:(AVUserResultBlock)block
Parameters
platform |
if the auth data belongs to Weibo, QQ or Weixin(Wechat),
please use |
---|---|
block |
result callback. |
Discussion
Disassociate the specified platform’s auth data from a instance of AVUser.
Declared In
AVUser.h
– signUp
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
Return Value
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
AVUser.h
– signUpInBackground
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)signUpInBackground
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
AVUser.h
– 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.
- (void)signUpInBackgroundWithTarget:(id)target selector:(SEL)selector
Parameters
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: |
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
AVUser.h
– updatePassword:newPassword:withTarget:selector:
update user’s password
- (void)updatePassword:(NSString *)oldPassword newPassword:(NSString *)newPassword withTarget:(id)target selector:(SEL)selector
Parameters
oldPassword |
old password |
---|---|
newPassword |
new password |
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: |
Discussion
update user’s password
Declared In
AVUser.h
+ logInWithUsername:password:
Makes a request to login a user with specified credentials. Returns an instance of the successfully logged in AVUser. This will also cache the user locally so that calls to userFromCurrentUser will use the latest logged in user.
+ (nullable instancetype)logInWithUsername:(NSString *)username password:(NSString *)password
Return Value
an instance of the AVUser 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 AVUser. This will also cache the user locally so that calls to userFromCurrentUser will use the latest logged in user.
Declared In
AVUser.h
+ logInWithUsernameInBackground:password:
Makes an asynchronous request to login a user with specified credentials. Returns an instance of the successfully logged in AVUser. 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
Discussion
Makes an asynchronous request to login a user with specified credentials. Returns an instance of the successfully logged in AVUser. This will also cache the user locally so that calls to userFromCurrentUser will use the latest logged in user.
Declared In
AVUser.h
+ logInWithUsernameInBackground:password:target:selector:
Makes an asynchronous request to login a user with specified credentials. Returns an instance of the successfully logged in AVUser. 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:(AVUser *)user error:(NSError **)error
+ (void)logInWithUsernameInBackground:(NSString *)username password:(NSString *)password target:(id)target selector:(SEL)selector
Parameters
username |
|
---|---|
password |
|
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 AVUser. 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:(AVUser *)user error:(NSError **)error
Declared In
AVUser.h
+ logInWithMobilePhoneNumber:password:
+ (nullable instancetype)logInWithMobilePhoneNumber:(NSString *)phoneNumber password:(NSString *)password
+ logInWithMobilePhoneNumberInBackground:password:
+ (void)logInWithMobilePhoneNumberInBackground:(NSString *)phoneNumber password:(NSString *)password
+ logInWithMobilePhoneNumberInBackground:password:target:selector:
+ (void)logInWithMobilePhoneNumberInBackground:(NSString *)phoneNumber password:(NSString *)password target:(id)target selector:(SEL)selector
+ logInWithMobilePhoneNumber:smsCode:
+ (nullable instancetype)logInWithMobilePhoneNumber:(NSString *)phoneNumber smsCode:(NSString *)code
+ logInWithMobilePhoneNumberInBackground:smsCode:
+ (void)logInWithMobilePhoneNumberInBackground:(NSString *)phoneNumber smsCode:(NSString *)code
+ logInWithMobilePhoneNumberInBackground:smsCode:target:selector:
+ (void)logInWithMobilePhoneNumberInBackground:(NSString *)phoneNumber smsCode:(NSString *)code target:(id)target selector:(SEL)selector
+ 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.
+ (BOOL)requestPasswordResetForEmail:(NSString *)email
Parameters
email |
Email of the account to send a reset password request. |
---|
Return Value
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
AVUser.h
+ 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.
+ (void)requestPasswordResetForEmailInBackground:(NSString *)email
Parameters
email |
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
AVUser.h
+ 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.
+ (void)requestPasswordResetForEmailInBackground:(NSString *)email target:(id)target selector:(SEL)selector
Parameters
email |
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
AVUser.h
– isAuthenticated
Whether the user is an authenticated object for the device. An authenticated AVUser 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)isAuthenticated
Return Value
whether the user is authenticated.
Discussion
Whether the user is an authenticated object for the device. An authenticated AVUser 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
AVUser.h