友盟分享失败后有回调吗_友盟分享成功回调问题

要在appdelegate里实现这两个方法,特别是下面的那个,如果是iOS9  一定要实现  否则不走回调。

//@implementation AppDelegate (UMeng)

- (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url{

return  [UMSocialSnsService handleOpenURL:url];

}

-(BOOL)application:(UIApplication *)application openURL:(NSURL *)url options:(nonnull NSDictionary *)options{

return [UMSocialSnsService handleOpenURL:url];

}

//网页分享

- (void)shareWebPageToPlatformType:(UMSocialPlatformType)platformType url:(NSString *)url title:(NSString *)title description:(NSString *)description

{

//创建分享消息对象

UMSocialMessageObject *messageObject = [UMSocialMessageObject messageObject];

NSDictionary *infoPlist = [[NSBundle mainBundle] infoDictionary];

NSString *icon = [[infoPlist valueForKeyPath:@"CFBundleIcons.CFBundlePrimaryIcon.CFBundleIconFiles"] lastObject];

UIImage* image = [UIImage imageNamed:icon];

//创建网页内容对象

UMShareWebpageObject *shareObject = [UMShareWebpageObject shareObjectWithTitle:title descr:description thumImage:image];

//设置网页地址

shareObject.webpageUrl = url;

//分享消息对象设置分享内容对象

messageObject.shareObject = shareObject;

MPWeakSelf(self);

//调用分享接口

[[UMSocialManager defaultManager] shareToPlatform:platformType messageObject:messageObject currentViewController:self completion:^(id data, NSError *error) {

if (error) {

UMSocialLogInfo(@"************Share fail with error %@*********",error);

[MBProgressHUD showSuccess:@"分享失败" ToView:weakself.view];

}else{

[MBProgressHUD showSuccess:@"分享成功" ToView:weakself.view];

//

// 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);

// }

}

}];

}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值