微信登录

微信授权登录

-(void)Clbtn{
[[UMSocialManager defaultManager] getUserInfoWithPlatform:UMSocialPlatformType_WechatSession currentViewController:nil completion:^(id result, NSError *error) {
if (error) {

    } else {
        UMSocialUserInfoResponse *resp = result;
        // 授权信息
        NSLog(@"Wechat uid: %@", resp.uid);
        NSLog(@"Wechat openid: %@", resp.openid);
        NSLog(@"Wechat unionid: %@", resp.unionId);
        NSLog(@"Wechat accessToken: %@", resp.accessToken);
        NSLog(@"Wechat refreshToken: %@", resp.refreshToken);
        NSLog(@"Wechat expiration: %@", resp.expiration);
        // 用户信息
        NSLog(@"Wechat name: %@", resp.name);
        NSLog(@"Wechat iconurl: %@", resp.iconurl);
        NSLog(@"Wechat gender: %@", resp.unionGender);
        // 第三方平台SDK源数据
        NSLog(@"Wechat originalResponse: %@", resp.originalResponse);
    }
}];
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
}
-(void)btn{
//显示分享面板
[UMSocialUIManager showShareMenuViewInWindowWithPlatformSelectionBlock:^(UMSocialPlatformType platformType, NSDictionary *userInfo) {

    [self shareWebPageToPlatformType:platformType];
    
    // 根据获取的platformType确定所选平台进行下一步操作
}];
1
2
3
4
}

(void)shareWebPageToPlatformType:(UMSocialPlatformType)platformType
{
//创建分享消息对象
UMSocialMessageObject messageObject = [UMSocialMessageObject messageObject];
//创建网页内容对象
NSString thumbURL = @“https://mobile.umeng.com/images/pic/home/social/img-1.png”;
UMShareWebpageObject shareObject = [UMShareWebpageObject shareObjectWithTitle:@“欢迎使用【友盟+】社会化组件U-Share” descr:@“欢迎使用【友盟+】社会化组件U-Share,SDK包最小,集成成本最低,助力您的产品开发、运营与推广!” thumImage:thumbURL];
//设置网页地址
shareObject.webpageUrl = @“http://mobile.umeng.com/social”;
//分享消息对象设置分享内容对象
messageObject.shareObject = shareObject;
//调用分享接口
[[UMSocialManager defaultManager] shareToPlatform:platformType messageObject:messageObject currentViewController:self completion:^(id data, NSError error) {
if (error) {
UMSocialLogInfo(@"************Share fail with error %@*******",error);
}else{
if ([data isKindOfClass:[UMSocialShareResponse class]]) {
UMSocialShareResponse *resp = data;
//分享结果消息
UMSocialLogInfo(@“response message is %@”,resp.message);
//第三方原始返回的数据
UMSocialLogInfo(@“response originalResponse data is %@”,resp.originalResponse);
}else{
UMSocialLogInfo(@“response data is %@”,data);
}
}
}];
}
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值