7.4 微信登录添加配置文件参考文档:添加微信及朋友圈,添加相关库文件,配置URL schemes及添加系统回调注意微信登录必须先在微信开放平台申请微信登录权限在你的程序APPdelegate入口方法添加下面的代码 #import "UMSocialWechatHandler.h" //设置微信AppId、appSecret,分享url [UMSocialWechatHandler setWXAppId:@"wxd930ea5d5a258f4f" appSecret:@"db426a9829e4b49a0dcac7b4162da6b6" url:@"http://www.umeng.com/social"];在微信登录按钮中实现下面的方法 UMSocialSnsPlatform *snsPlatform = [UMSocialSnsPlatformManager getSocialPlatformWithName:UMShareToWechatsession]; snsPlatform.loginClickHandler(self,[UMSocialControllerService defaultControllerService],YES,^(UMSocialResponseEntity *response){ if (response.responseCode == UMSResponseCodeSuccess) { UMSocialAccountEntity *snsAccount = [[UMSocialAccountManager socialAccountDictionary]valueForKey:UMShareToWechatSession]; NSLog(@"username is %@, uid is %@, token is %@ url is %@",snsAccount.userName,snsAccount.usid,snsAccount.accessToken,snsAccount.iconURL); } });在授权完成后调用获取用户信息的方法//得到的数据在回调Block对象形参respone的data属性[[UMSocialDataService defaultDataService] requestSnsInformation:UMShareToWechatsession completion:^(UMSocialResponseEntity *response){ NSLog(@"SnsInformation is %@",response.data);
openid
对应友盟里叫usid
下面是授权成功的回调数据:
- UMSocial: makeRequestWithPath is /share/token/53290df956240b6b4a0084b3/, parameters is { "access_token" = "OezXcEiiBSKSxW0eoylIeJDUKD6z6dmr42JANLPjNN56WRFnd-vVJO37ma0gCpKY1v5q8EVEMwdQQzvXoFFpe1jQXUzjqukub9-228J8sjvugvVVQYvzkhyvAgItvkYmMIGD_cE2hAWUm44_qCB-oQ"; ak = 53290df956240b6b4a0084b3; de = "iphone7,1"; dt = 1438857527939; ek = 4b37315fd0421b0b3a682a4a5e4487e9; en = WiFi; "expires_in" = 7199; mac = "02:00:00:00:00:00"; openid = oyAaTjrJMAb3qfCbyDRp3h0NKyew; openudid = 147ad485c3b80ffd54bfc8689c2d7db1ed88994b; os = iOS; pcv = "2.0"; "refresh_token" = "OezXcEiiBSKSxW0eoylIeJDUKD6z6dmr42JANLPjNN56WRFnd-vVJO37ma0gCpKYHXgyDeQ4Xqm60G-omrGp2u-KbIy7zTP5gV5dnw3RVN-GzkjY8gCWIMC3_cCHcflH6IPexy2c-k46gGG0M07p6g"; sdkv = "4.2.3"; to = wxsession; tp = 0; uid = 462ae0edb57d53dfd2affb5e4ae36ad; usid = oyAaTjrJMAb3qfCbyDRp3h0NKyew;} [18:38:48.197( 2055)] - UMSocial: actionType is 15 , received json Dic is { data = { }; msg = "no error"; st = 200;}新闻热点
疑难解答