Second login or authorization of Youmeng Weibo, user uid and other information are empty

Keywords: Mobile SDK

Today, I'm not busy. I'll test my own app at will. I found a bug when integrating the three parties of the alliance to log in, after logging in the microblog and binding the mobile phone number.
When I start the app for the first time to log in with authorization and bind the mobile phone number, it is normal to unbind. Click again to bind the callback information of the authorization page immediately. All the uid information is null. No mistake is null.
Finally, we found that the error happened here.
At this time, it is estimated that you put the binding operation in the callback of authorization success. A judgment is needed

 #pragma mark - three party login
- (void)getUserInfoForPlatform:(UMSocialPlatformType)platformType
{
    WEAKSELF
    [[UMSocialManager defaultManager] getUserInfoWithPlatform:platformType currentViewController:nil completion:^(id result, NSError *error) {
        NSString *message = nil;
        if (error) {
            message = [NSString stringWithFormat:@"Get info fail:\n%@", error];
            UMSocialLogInfo(@"Get info fail with error %@",error);
        }else{
            if ([result isKindOfClass:[UMSocialUserInfoResponse class]]) {
                UMSocialUserInfoResponse *resp = result;
                // Third party login data (if blank, the platform does not provide it)
                // Authorized data
                NSLog(@" uid: %@", resp.uid);
                NSLog(@" openid: %@", resp.openid);
                NSLog(@" accessToken: %@", resp.accessToken);
                NSLog(@" refreshToken: %@", resp.refreshToken);
                NSLog(@" expiration: %@", resp.expiration);
                // user data
                NSLog(@" name: %@", resp.name);
                NSLog(@" iconurl: %@", resp.iconurl);
                NSLog(@" gender: %@", resp.unionGender);
                // Third party Platform SDK raw data
                NSLog(@" originalResponse: %@", resp.originalResponse);
                if ([resp.uid length] > 0) {
                    //Perform binding operation
                }
            }else{
                message = @"Get info fail";
            }
        }
    }];
}

That solved my bug
In fact, I don't particularly understand. Why does the callback go again after unbinding, and the information is clear or empty when there is no authorization... What about it? I hope that the God knows the message to me.

Posted by Dragoa on Wed, 01 Apr 2020 23:58:00 -0700