iOS开发中集成友盟6.0.0发现的问题

4 篇文章 0 订阅

1.设置分享到QQ互联的appKeyappSecret

    QQ互联中创建的应用只有appID和appKey,但是友盟设置分享到QQ互联却需要appKeyappSecret,这个appSecret在QQ互联中是找不到的。正确的设置方法是:

//设置分享到QQ互联的appKeyappSecret

    [[UMSocialManager defaultManager] setPlaform:UMSocialPlatformType_QQ appKey:@"QQ互联的appID"  appSecret:@"QQ互联的appKey" redirectURL:@"http://mobile.umeng.com/social"];


2.集成友盟第三方登录,提示代码错误

友盟文档中的代码:

  • 向第三方平台获取授权

#import <UMSocialCore/UMSocialCore.h>

-(void)authWithPlatform:(UMSocialPlatformType)platformType{  

[[UMSocialManager defaultManager] authWithPlatform:platformType completion:^(id result, NSError *error) {   [self.tableView reloadData];  

UMSocialAuthResponse *authresponse = result;  

NSString *message = [NSString stringWithFormat:@"result: %d\n uid: %@\n accessToken: %@\n",(int)error.code,authresponse.uid,authresponse.accessToken];  

UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Login" message:message delegate:nil  

cancelButtonTitle:NSLocalizedString(@"确定", nil)  

otherButtonTitles:nil];  

[alert show];  

}];

}

  • 获取用户信息

#import <UMSocialCore/UMSocialCore.h>

- (void)getUserInfoForPlatform:(UMSocialPlatformType)platformType{  

[[UMSocialManager defaultManager] getUserInfoWithPlatform:platformType completion:^(id result, NSError *error) {   UMSocialUserInfoResponse *userinfo =result;  

NSString *message = [NSString stringWithFormat:@"name: %@\n icon: %@\n gender: %@\n",userinfo.name,userinfo.iconurl,userinfo.gender];

UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"UserInfo"

message:message

delegate:nil

cancelButtonTitle:NSLocalizedString(@"确定", nil)

otherButtonTitles:nil];

[alert show];

}];

}

将报错的方法替换为下面两个方法:

//授权平台

- (void)authWithPlatform:(UMSocialPlatformType)platformType

   currentViewController:(id)currentViewController

              completion:(UMSocialRequestCompletionHandler)completion;

//获取用户信息

- (void)getUserInfoWithPlatform:(UMSocialPlatformType)platformType

          currentViewController:(id)currentViewController

                     completion:(UMSocialRequestCompletionHandler)completion;



3.QQ登录会出现两次授权的情况

分析:

    出现两次授权页面的原因:授权登录的流程是,先获取授权信息,再获取用户信息。而QQ登录时,获取授权信息会跳转到授权界面,而获取用户信息时也会跳转到授权页面,所以才会出现两次跳转到授权页面。


解决办法:

    不调用授权方法,直接获取用户信息。


4.分享,代码报错


将错误的方法替换为:

- (void)shareToPlatform:(UMSocialPlatformType)platformType

          messageObject:(UMSocialMessageObject *)messageObject

  currentViewController:(id)currentViewController

             completion:(UMSocialRequestCompletionHandler)completion;



5.分享,失败2005


添加代码:messageObject.shareObject = shareObject;





  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 4
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

jinrui_w

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值