Last Updated on : 2023-12-07 03:15:42download
Description
If had registered, then automatically logged in. If had not registered, then automatically registered and logged in.
- (void)loginOrRegisterWithCountryCode:(NSString *)countryCode
uid:(NSString *)uid
password:(NSString *)password
createHome:(BOOL)createHome
success:(nullable TYSuccessID)success
failure:(nullable TYFailureError)failure;
Parameters
Param | Description |
---|---|
countryCode | Country code, for example: 86 |
uid | The user ID. |
password | Password |
createHome | Whether to create a default family |
success | Success Callback |
failure | Failure Callback |
Example
Objc:
[[TuyaSmartUser sharedInstance] loginOrRegisterWithCountryCode:@"your_country_code" uid:@"your_uid" password:@"your_password" createHome:YES success:^(id result) {
NSLog(@"loginOrRegisterWithCountryCode success: %@", result);
} failure:^(NSError *error) {
NSLog(@"loginOrRegisterWithCountryCode failure: %@", error);
}];
Swift:
TuyaSmartUser.sharedInstance()?.loginOrRegisterWithCountryCode("your_country_code", uid: "your_uid", password: "your_password", createHome: true, success: { (result) in
print("loginOrRegisterWithCountryCode success: \(result)")
}, failure: { (error) in
if let e = error {
print("loginOrRegisterWithCountryCode failure: \(e)")
}
})
Is this page helpful?
YesFeedbackIs this page helpful?
YesFeedback