iOS 微博,微信第三方登录UM

编程入门 行业动态 更新时间:2024-10-23 09:34:01

iOS 微博,微信<a href=https://www.elefans.com/category/jswz/34/1770258.html style=第三方登录UM"/>

iOS 微博,微信第三方登录UM

/**
 * 微信登录
 */
- (IBAction)btnWeiXinLoginPressed:(id)sender {
    
    //
    //    [UMSocialWechatHandler setWXAppId:@"wxe703a7f636765bb5" appSecret:@"146f0853232d25435e5d97a87ecd138d" url:appUrl];
    
    UMSocialSnsPlatform *snsPlatform = [UMSocialSnsPlatformManager getSocialPlatformWithName:UMShareToWechatSession];
    
    snsPlatform.loginClickHandler(self,[UMSocialControllerService defaultControllerService],YES,^(UMSocialResponseEntity *response){
        
        if (response.responseCode == UMSResponseCodeSuccess) {
            
            NSDictionary *dict = [UMSocialAccountManager socialAccountDictionary];
            UMSocialAccountEntity *snsAccount = [[UMSocialAccountManager socialAccountDictionary] valueForKey:snsPlatform.platformName];
            NSLog(@"\nusername = %@,\n usid = %@,\n token = %@ iconUrl = %@,\n unionId = %@,\n thirdPlatformUserProfile = %@,\n thirdPlatformResponse = %@ \n, message = %@",snsAccount.userName,snsAccount.usid,snsAccount.accessToken,snsAccount.iconURL, snsAccount.unionId, response.thirdPlatformUserProfile, response.thirdPlatformResponse, response.message);
            
            NSDictionary *dic = @{@"uid":snsAccount.usid};
            [RequestEngine postRequestHttp:@"/user/uidLogin.do" paramDic:dic blockObject:^(NSDictionary *dic) {
                if (dic) {
                    id dict = [dic objectForKey:@"data"];
                    NSString *userName = @"";
                    if ([dict isKindOfClass:[NSDictionary class]]) {
                        userName = [NSString stringWithFormat:@"%@",[(NSDictionary *)dict objectForKey:@"userinfo_id"]];
                    }else{
                        userName = [NSString stringWithFormat:@"%@",[dic objectForKey:@"data"]];
                    }
                    NSString *pwd = [NSString stringWithFormat:@"%i1",[userName intValue]];
                    [self hxLoginWithUserName:userName WithPassword:pwd];//从第三方获取数据后,在当前app用获取到的数据注册,注册是后台写好的接口;
                    
                }
            }];


        }
        
    });
    
}

更多推荐

iOS 微博,微信第三方登录UM

本文发布于:2024-02-07 02:34:27,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1752374.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:第三方   iOS   微博   UM

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!