LCUser
Objective-C
@interface LCUser : LCObject <LCSubclassing>
Swift
class LCUser : LCObject, LCSubclassing
User
-
Undocumented
Declaration
Objective-C
+ (nullable instancetype)currentUser;Swift
class func current() -> Self? -
Undocumented
Declaration
Objective-C
+ (void)changeCurrentUser:(LCUser *_Nullable)newUser save:(BOOL)save;Swift
class func changeCurrentUser(_ newUser: LCUser?, save: Bool) -
The session token for the LCUser. This is set by the server upon successful authentication.
Declaration
Objective-C
@property (nonatomic, copy, nullable) NSString *sessionToken;Swift
var sessionToken: String? { get set } -
Whether the LCUser was just created from a request. This is only set after a Facebook or Twitter login.
Declaration
Objective-C
@property (nonatomic, readonly) BOOL isNew;Swift
var isNew: Bool { get } -
Undocumented
Declaration
Objective-C
- (void)isAuthenticatedWithSessionToken:(nonnull NSString *)sessionToken callback:(nonnull LCBooleanResultBlock)callback;Swift
func isAuthenticated(withSessionToken sessionToken: String, callback: @escaping LCBooleanResultBlock)
-
Undocumented
Declaration
Objective-C
+ (nonnull instancetype)user; -
Undocumented
Declaration
Objective-C
+ (void)enableAutomaticUser;Swift
class func enableAutomaticUser() -
The username for the LCUser.
Declaration
Objective-C
@property (nonatomic, copy, nullable) NSString *username;Swift
var username: String? { get set } -
The password for the LCUser. This will not be filled in from the server with the password. It is only meant to be set.
Declaration
Objective-C
@property (nonatomic, copy, nullable) NSString *password;Swift
var password: String? { get set } -
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.
Declaration
Objective-C
@property (nonatomic, copy, nullable) NSString *email;Swift
var email: String? { get set } -
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.
Declaration
Objective-C
@property (nonatomic, copy, nullable) NSString *mobilePhoneNumber;Swift
var mobilePhoneNumber: String? { get set } -
Mobile phone number verification flag. Read-only. if calling verifyMobilePhone:withBlock: succeeds, the server will set this value YES.
Declaration
Objective-C
@property (nonatomic, readonly) BOOL mobilePhoneVerified;Swift
var mobilePhoneVerified: Bool { get } -
请求重发验证邮件 如果用户邮箱没有得到验证或者用户修改了邮箱, 通过本方法重新发送验证邮件.
Warning
为防止滥用,同一个邮件地址,1分钟内只能发1次!
Declaration
Objective-C
+ (void)requestEmailVerify:(nonnull NSString *)email withBlock:(nonnull LCBooleanResultBlock)block;Swift
class func requestEmailVerify(_ email: String, with block: @escaping LCBooleanResultBlock)Parameters
email邮件地址
block回调结果
-
Undocumented
Declaration
Objective-C
- (BOOL)signUp:(NSError *_Nullable *_Nullable)error;Swift
func signUp() throws -
Undocumented
Declaration
Objective-C
- (BOOL)signUpAndThrowsWithError:(NSError *_Nullable *_Nullable)error;Swift
func signUpAndThrows() throws -
Undocumented
Declaration
Objective-C
- (void)signUpInBackgroundWithBlock:(nonnull LCBooleanResultBlock)block;Swift
func signUpInBackground() async throws -> Bool -
Undocumented
Declaration
Objective-C
- (void)updatePassword:(nonnull NSString *)oldPassword newPassword:(nonnull NSString *)newPassword block:(nonnull LCIdResultBlock)block;Swift
func updatePassword(_ oldPassword: String, newPassword: String, block: @escaping LCIdResultBlock) -
Undocumented
Declaration
Objective-C
- (void)refreshSessionTokenWithBlock:(nonnull LCBooleanResultBlock)block;Swift
func refreshSessionToken() async throws -> Bool -
Undocumented
Declaration
Objective-C
+ (nullable instancetype)logInWithUsername:(nonnull NSString *)username password:(nonnull NSString *)password error:(NSError *_Nullable *_Nullable)error;Swift
class func logIn(withUsername username: String, password: String) throws -> Self -
Undocumented
Declaration
Objective-C
+ (void)logInWithUsernameInBackground:(nonnull NSString *)username password:(nonnull NSString *)password block:(nonnull LCUserResultBlock)block;Swift
class func logInWithUsername(inBackground username: String, password: String, block: @escaping LCUserResultBlock) -
Login by email and password.
Declaration
Objective-C
+ (void)loginWithEmail:(nonnull NSString *)email password:(nonnull NSString *)password block:(nonnull LCUserResultBlock)block;Swift
class func login(withEmail email: String, password: String, block: @escaping LCUserResultBlock)Parameters
emailThe email string.
passwordThe password string.
blockcallback.
-
Undocumented
Declaration
Objective-C
+ (nullable instancetype) logInWithMobilePhoneNumber:(nonnull NSString *)phoneNumber password:(nonnull NSString *)password error:(NSError *_Nullable *_Nullable)error;Swift
class func logIn(withMobilePhoneNumber phoneNumber: String, password: String) throws -> Self -
Undocumented
Declaration
Objective-C
+ (void)logInWithMobilePhoneNumberInBackground:(nonnull NSString *)phoneNumber password:(nonnull NSString *)password block:(nonnull LCUserResultBlock)block;Swift
class func logInWithMobilePhoneNumber(inBackground phoneNumber: String, password: String, block: @escaping LCUserResultBlock) -
Undocumented
Declaration
Objective-C
+ (void)requestLoginSmsCode:(nonnull NSString *)phoneNumber withBlock:(nonnull LCBooleanResultBlock)block;Swift
class func requestLoginSmsCode(_ phoneNumber: String, with block: @escaping LCBooleanResultBlock) -
Request a login code for a phone number.
Declaration
Objective-C
+ (void)requestLoginCodeForPhoneNumber:(nonnull NSString *)phoneNumber options: (nullable LCUserShortMessageRequestOptions *) options callback:(nonnull LCBooleanResultBlock)callback;Swift
class func requestLoginCode(forPhoneNumber phoneNumber: String, options: LCUserShortMessageRequestOptions?, callback: @escaping LCBooleanResultBlock)Parameters
phoneNumberThe phone number of an user who will login later.
optionsThe short message request options.
callbackThe callback of request.
-
Undocumented
Declaration
Objective-C
+ (nullable instancetype) logInWithMobilePhoneNumber:(nonnull NSString *)phoneNumber smsCode:(nonnull NSString *)code error:(NSError *_Nullable *_Nullable)error;Swift
class func logIn(withMobilePhoneNumber phoneNumber: String, smsCode code: String) throws -> Self -
Undocumented
Declaration
Objective-C
+ (void)logInWithMobilePhoneNumberInBackground:(nonnull NSString *)phoneNumber smsCode:(nonnull NSString *)code block:(nonnull LCUserResultBlock)block;Swift
class func logInWithMobilePhoneNumber(inBackground phoneNumber: String, smsCode code: String, block: @escaping LCUserResultBlock) -
Undocumented
Declaration
Objective-C
+ (nullable instancetype) signUpOrLoginWithMobilePhoneNumber:(nonnull NSString *)phoneNumber smsCode:(nonnull NSString *)code error:(NSError *_Nullable *_Nullable)error;Swift
class func signUpOrLogin(withMobilePhoneNumber phoneNumber: String, smsCode code: String) throws -> Self -
Undocumented
Declaration
Objective-C
+ (void)signUpOrLoginWithMobilePhoneNumberInBackground: (nonnull NSString *)phoneNumber smsCode:(nonnull NSString *)code block: (nonnull LCUserResultBlock) block;Swift
class func signUpOrLoginWithMobilePhoneNumber(inBackground phoneNumber: String, smsCode code: String, block: @escaping LCUserResultBlock) -
Use mobile phone number & SMS code & password to sign up or login.
Declaration
Objective-C
+ (void) signUpOrLoginWithMobilePhoneNumberInBackground: (nonnull NSString *)phoneNumber smsCode:(nonnull NSString *)smsCode password:(nonnull NSString *)password block:(nonnull LCUserResultBlock) block;Swift
class func signUpOrLoginWithMobilePhoneNumber(inBackground phoneNumber: String, smsCode: String, password: String, block: @escaping LCUserResultBlock)Parameters
phoneNumberPhone number.
smsCodeSMS code.
passwordPassword.
blockResult callback.
-
Clearing local persistent cache data of the current user and set it to
nil. It will also clearing local persistent cache of anonymous id.Declaration
Objective-C
+ (void)logOut;Swift
class func logOut() -
Clearing local persistent cache data of the current user and set it to
nil.Declaration
Objective-C
+ (void)logOutWithClearingAnonymousId:(BOOL)clearingAnonymousId;Swift
class func logOut(withClearingAnonymousId clearingAnonymousId: Bool)Parameters
clearingAnonymousIdtruemeans clearing local persistent cache of anonymous id,falsemeans NOT.
-
Undocumented
Declaration
Objective-C
+ (BOOL)requestPasswordResetForEmail:(nonnull NSString *)email error:(NSError *_Nullable *_Nullable)error;Swift
class func requestPasswordReset(forEmail email: String) throws -
Undocumented
Declaration
Objective-C
+ (void)requestPasswordResetForEmailInBackground:(nonnull NSString *)email block:(nonnull LCBooleanResultBlock) block;Swift
class func requestPasswordResetForEmail(inBackground email: String, block: @escaping LCBooleanResultBlock) -
Undocumented
Declaration
Objective-C
+ (void)requestPasswordResetWithPhoneNumber:(nonnull NSString *)phoneNumber block:(nonnull LCBooleanResultBlock)block;Swift
class func requestPasswordReset(withPhoneNumber phoneNumber: String, block: @escaping LCBooleanResultBlock) -
Request a password reset code for a phone number.
Declaration
Objective-C
+ (void) requestPasswordResetCodeForPhoneNumber:(nonnull NSString *)phoneNumber options: (nullable LCUserShortMessageRequestOptions *) options callback: (nonnull LCBooleanResultBlock)callback;Swift
class func requestPasswordResetCode(forPhoneNumber phoneNumber: String, options: LCUserShortMessageRequestOptions?, callback: @escaping LCBooleanResultBlock)Parameters
phoneNumberThe phone number of an user whose password will be reset.
optionsThe short message request options.
callbackThe callback of request.
-
Undocumented
Declaration
Objective-C
+ (void)resetPasswordWithSmsCode:(nonnull NSString *)code newPassword:(nonnull NSString *)password phoneNumber:(nonnull NSString *)phoneNumber block:(nonnull LCBooleanResultBlock)block;Swift
class func resetPassword(withSmsCode code: String, newPassword password: String, phoneNumber: String, block: @escaping LCBooleanResultBlock) -
Undocumented
Declaration
Objective-C
+ (void)becomeWithSessionTokenInBackground:(nonnull NSString *)sessionToken block:(nonnull LCUserResultBlock)block;Swift
class func becomeWithSessionToken(inBackground sessionToken: String, block: @escaping LCUserResultBlock) -
Undocumented
Declaration
Objective-C
+ (nullable instancetype)becomeWithSessionToken:(nonnull NSString *)sessionToken error:(NSError *_Nullable *_Nullable) error;Swift
class func become(withSessionToken sessionToken: String) throws -> Self
-
Undocumented
-
Request a SMS code to verify phone number.
Declaration
Objective-C
+ (void)requestMobilePhoneVerify:(nonnull NSString *)phoneNumber withBlock: (nonnull void (^)(BOOL, NSError *_Nullable))block;Swift
class func requestMobilePhoneVerify(_ phoneNumber: String, with block: @escaping (Bool, Error?) -> Void)Parameters
phoneNumberThe phone number to receive SMS code.
blockThe result callback.
-
Request a SMS code to verify phone number.
Declaration
Objective-C
+ (void)requestVerificationCodeForPhoneNumber:(nonnull NSString *)phoneNumber options:(LCUserShortMessageRequestOptions *_Nullable)options callback: (nonnull void (^)( BOOL, NSError *_Nullable))callback;Swift
class func requestVerificationCode(forPhoneNumber phoneNumber: String, options: LCUserShortMessageRequestOptions?, callback: @escaping (Bool, Error?) -> Void)Parameters
phoneNumberThe phone number to receive SMS code.
optionscallbackThe result callback.
-
Verify a phone number with the SMS code.
Declaration
Objective-C
+ (void)verifyCodeForPhoneNumber:(nonnull NSString *)phoneNumber code:(nonnull NSString *)code block:(nonnull void (^)(BOOL, NSError *_Nullable))block;Swift
class func verifyCode(forPhoneNumber phoneNumber: String, code: String, block: @escaping (Bool, Error?) -> Void)Parameters
phoneNumberThe phone number to be verified.
codeThe verification code.
blockThe result callback.
-
Request a SMS code to bind or update phone number.
Declaration
Objective-C
+ (void) requestVerificationCodeForUpdatingPhoneNumber: (nonnull NSString *)phoneNumber options: (LCUserShortMessageRequestOptions *_Nullable)options block:(nonnull void (^)( BOOL, NSError *_Nullable))block;Swift
class func requestVerificationCode(forUpdatingPhoneNumber phoneNumber: String, options: LCUserShortMessageRequestOptions?, block: @escaping (Bool, Error?) -> Void)Parameters
phoneNumberThe phone number to receive SMS code.
optionsblockThe result callback.
-
Verify a phone number with the SMS code to bind or update phone number.
Declaration
Objective-C
+ (void)verifyCodeToUpdatePhoneNumber:(nonnull NSString *)phoneNumber code:(nonnull NSString *)code block: (nonnull void (^)(BOOL, NSError *_Nullable))block;Swift
class func verifyCode(toUpdatePhoneNumber phoneNumber: String, code: String, block: @escaping (Bool, Error?) -> Void)Parameters
phoneNumberThe phone number to be bound or updated.
codeThe verification code.
blockThe result callback.
-
Login use auth data.
Declaration
Objective-C
- (void)loginWithAuthData:(nonnull NSDictionary *)authData platformId:(nonnull NSString *)platformId options:(LCUserAuthDataLoginOption *_Nullable)options callback:(nonnull void (^)(BOOL, NSError *_Nullable))callback;Swift
func login(withAuthData authData: [AnyHashable : Any], platformId: String, options: LCUserAuthDataLoginOption?, callback: @escaping (Bool, Error?) -> Void)Parameters
authDataGet from third platform, data format e.g. { “id” : “id_string”, “access_token” : “access_token_string”, … … }.
platformIdThe key for the auth data, to identify auth data.
optionsSee LCUserAuthDataLoginOption.
callbackResult callback.
-
Associate auth data to the LCUser instance.
Declaration
Objective-C
- (void)associateWithAuthData:(nonnull NSDictionary *)authData platformId:(nonnull NSString *)platformId options:(LCUserAuthDataLoginOption *_Nullable)options callback: (nonnull void (^)(BOOL, NSError *_Nullable))callback;Swift
func associate(withAuthData authData: [AnyHashable : Any], platformId: String, options: LCUserAuthDataLoginOption?, callback: @escaping (Bool, Error?) -> Void)Parameters
authDataGet from third platform, data format e.g. { “id” : “id_string”, “access_token” : “access_token_string”, … … }.
platformIdThe key for the auth data, to identify auth data.
optionsSee LCUserAuthDataLoginOption.
callbackResult callback.
-
Disassociate auth data from the LCUser instance.
Declaration
Objective-C
- (void)disassociateWithPlatformId:(nonnull NSString *)platformId callback:(nonnull void (^)(BOOL, NSError *_Nullable)) callback;Swift
func disassociate(withPlatformId platformId: String, callback: @escaping (Bool, Error?) -> Void)Parameters
platformIdThe key for the auth data, to identify auth data.
callbackResult callback.
-
Login anonymously.
Declaration
Objective-C
+ (void)loginAnonymouslyWithCallback: (nonnull void (^)(LCUser *_Nullable, NSError *_Nullable))callback;Swift
class func loginAnonymously(callback: @escaping (LCUser?, Error?) -> Void)Parameters
callbackResult callback.
-
Check whether the instance of LCUser is anonymous.
Declaration
Objective-C
- (BOOL)isAnonymous;Swift
func isAnonymous() -> BoolReturn Value
Result.
-
More restrictive on query conditions to find user. Constraints: NOT support
skip; NOT support the protected fields; NOT supportinQuery…Declaration
Objective-C
+ (void)strictlyFindWithQuery:(nonnull LCQuery *)query callback:(nonnull void (^)(NSArray<LCUser *> *_Nullable, NSError *_Nullable))callback;Swift
class func strictlyFind(with query: LCQuery, callback: @escaping ([LCUser]?, Error?) -> Void)Parameters
queryThe query conditions.
callbackResult callback.
-
Undocumented
Declaration
Objective-C
+ (void)retrieveShortTokenWithCallback:(void (^)(NSString * _Nullable jwt, NSError * _Nullable error))callback;Swift
class func retrieveShortToken(callback: @escaping (String?, Error?) -> Void)
-
获取本用户粉丝LCQuery
Return Value
用于查询的LCQuery
-
获取本用户关注LCQuery
Return Value
用于查询的LCQuery
-
通过ID来关注其他用户
Warning
如果需要被关注者收到消息 需要手动给他发送一条LCStatus.Declaration
Objective-C
- (void)follow:(nonnull NSString *)userId andCallback:(nonnull LCBooleanResultBlock)callback;Swift
func follow(_ userId: String, andCallback callback: @escaping LCBooleanResultBlock)Parameters
userId要关注的用户objectId
callback回调结果
-
通过ID来关注其他用户
Warning
如果需要被关注者收到消息 需要手动给他发送一条LCStatus.Declaration
Objective-C
- (void)follow:(nonnull NSString *)userId userDictionary:(nullable NSDictionary *)dictionary andCallback:(nonnull LCBooleanResultBlock)callback;Swift
func follow(_ userId: String, userDictionary dictionary: [AnyHashable : Any]?, andCallback callback: @escaping LCBooleanResultBlock)Parameters
userId要关注的用户objectId
dictionary添加的自定义属性
callback回调结果
-
通过ID来取消关注其他用户
Declaration
Objective-C
- (void)unfollow:(nonnull NSString *)userId andCallback:(nonnull LCBooleanResultBlock)callback;Swift
func unfollow(_ userId: String, andCallback callback: @escaping LCBooleanResultBlock)Parameters
userId要取消关注的用户objectId
callback回调结果
-
获取当前用户粉丝的列表
Declaration
Objective-C
- (void)getFollowers:(nonnull LCArrayResultBlock)callback;Swift
func getFollowers(_ callback: @escaping LCArrayResultBlock)Parameters
callback回调结果
-
获取当前用户所关注的列表
Declaration
Objective-C
- (void)getFollowees:(nonnull LCArrayResultBlock)callback;Swift
func getFollowees(_ callback: @escaping LCArrayResultBlock)Parameters
callback回调结果
-
同时获取当前用户的粉丝和关注列表
Declaration
Objective-C
- (void)getFollowersAndFollowees:(nonnull LCDictionaryResultBlock)callback;Swift
func getFollowersAndFollowees(_ callback: @escaping LCDictionaryResultBlock)Parameters
callback回调结果, 列表字典包含
followers数组和followees数组
View on GitHub
Install in Dash
LCUser Class Reference