一、登录(注销)淘宝
标准登录
-(void)showLogin{
if(![[TaeSession sharedInstance] isLogin]){
[ALBBService(ALBBLoginService) showLogin:self successCallback:_loginSuccessCallback failedCallback:_loginFailedCallback];
}else{
TaeSession *session=[TaeSession sharedInstance];
NSString *tip=[NSString stringWithFormat:@"登录的用户信息:%@,登录时间:%@",[session getUser],[session getLoginTime]];
NSLog(@"%@", tip);
[[MyAlertView alertViewWithTitle:@"登录成功" message:tip onBtnClicked:nil cancelButtonTitle:@"确定" otherButtonTitles:nil]show];
}
}
H5登录
-(void)showLoginH5{
if(![[TaeSession sharedInstance] isLogin]){
[ALBBService(ALBBLoginService) showLogin:self successCallback:_loginSuccessCallback failedCallback:_loginFailedCallback notUseTaobaoAppLogin:YES];
}else{
TaeSession *session=[TaeSession sharedInstance];
NSString *tip=[NSString stringWithFormat:@"登录的用户信息:%@,登录时间:%@",[session getUser],[session getLoginTime]];
NSLog(@"%@", tip);
[[MyAlertView alertViewWithTitle:@"登录成功" message:tip onBtnClicked:nil cancelButtonTitle:@"确定" otherButtonTitles:nil]show];
}
}
注销登录
-(void)logout{
[ALBBService(ALBBLoginService) logout];
[[MyAlertView alertViewWithTitle:nil message:@"用户注销" onBtnClicked:nil cancelButtonTitle:@"确定" otherButtonTitles:nil]show];
}
淘宝授权登录
-(void)showLogin{
id<ALBBLoginService> loginService=[[ALBBSDK sharedInstance]getService:@protocol(ALBBLoginService)];
if(![[TaeSession sharedInstance] isLogin]){
[loginService showLogin:self successCallback:^(TaeSession *session){
NSString *tip=[NSString stringWithFormat:@"登录的用户信息:%@,登录时间:%@",[session getUser],[session getLoginTime]];
NSLog(@"%@", tip);
} failedCallback:^(NSError *error){
NSLog(@"登录失败");
}];
}else{
TaeSession *session=[TaeSession sharedInstance];
NSString *tip=[NSString stringWithFormat:@"登录的用户信息:%@,登录时间:%@",[session getUser],[session getLoginTime]];
NSLog(@"%@", tip);
}
}
//如果安装了手机淘宝会跳转到手机淘宝,否则唤起本地登录H5页面
注销登录
id<albbloginservice> loginService=[[ALBBSDK sharedInstance]getService:@protocol(ALBBLoginService)];
[loginService logout];