首先LineSDK v5.8.1 v5.8.2
获取Line的授权登录成功,
NSSet *permissions = [NSSet setWithObjects:
[LineSDKLoginPermission profile],
[LineSDKLoginPermission openID],
[LineSDKLoginPermission friends],
[LineSDKLoginPermission groups],
nil];
[[LineSDKLoginManager sharedManager] loginWithPermissions:permissions inViewController:vc completionHandler:^(LineSDKLoginResult * _Nullable loginResult, NSError * _Nullable error) {
if (error == nil) {
if (!loginResult.userProfile.userID && [loginResult.userProfile.userID isEqualToString:@""]) {
if (self.failure)
{
self.failure(error);
}
}else
{
#####竟然让人不可思议的是连续走了两次
// [NSObject cancelPreviousPerformRequestsWithTarget:self];
// [self performSelector:@selector(lineSdkSuccess:) withObject:loginResult afterDelay:2];
不得已进行中止线程
//后v5.9.0版本,更新后,貌似bug已经解决,仅仅一次,应该算是修复,希望后续不要有人也经历这个抓狂的BUG
if (loginResult.userProfile.userID && ![loginResult.userProfile.userID isEqualToString:@""]) {
HLSocialLoginInfo *info = [[HLSocialLoginInfo alloc]init];
info.userId = loginResult.userProfile.userID;
info.email = @"";
info.name = loginResult.userProfile.displayName;
NSLog(@"******lineUserId===%@",loginResult.userProfile.userID);
if (self.success) {
self.success(info);
}
}
}
}else
{
if (self.failure) {
self.failure(error);
}
}
}];