700字范文,内容丰富有趣,生活中的好帮手!
700字范文 > 友盟分享失败后有回调吗_友盟分享成功回调问题

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

时间:2019-07-30 21:56:17

相关推荐

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

要在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);

// }

}

}];

}

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。