友盟分享
来源:互联网 发布:飞机票抢票软件 编辑:程序博客网 时间:2024/05/13 23:58
—————————————集成—————————————
1. 导入框架包
2.Appdelegate.m 中做配置
1)#import "UMSocial.h" //友盟SDK #import "UMSocialWechatHandler.h"//微信SDK #import "UMSocialSinaHandler.h"//新浪微博SDK 2) - (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation { if ([url.description hasPrefix:@"gocom"]) { //你自己的逻辑 } else { return [UMSocialSnsService handleOpenURL:url];}
}
3)
- (BOOL)application:(UIApplication )application didFinishLaunchingWithOptions:(NSDictionary )launchOptions
//添加友盟
[UMSocialData setAppKey:IMShareMsgUMKey];
//设置微信AppId,设置分享url,默认使用友盟的网址
[UMSocialWechatHandler setWXAppId:IMShareWechatKey url:IMShareWechatUrl];
//打开新浪微博的SSO开关
[UMSocialSinaHandler openSSOWithRedirectURL:IMShareSinaUrl];
4)
- (BOOL)application:(UIApplication )application handleOpenURL:(NSURL )url
{
return [UMSocialSnsService handleOpenURL:url];
}
5)
—————————————方法实现—————————————
/**
* 打开分享到其他平台的列表
*
* @param sender 待分享的消息 (IMMsg)
*/
- (void)openShareList:(NSNotification *)sender
{
NSLog(@"正在打开分享列表");IMMsg *msg = [sender object];NSString *text = nil;UIImage *image = nil;//文本类型if (msg.msgType == IMMsgTypeText){ [UMSocialData defaultData].extConfig.wxMessageType = UMSocialWXMessageTypeText; IMTextMsg * textMsg = (IMTextMsg *)msg; text = textMsg.msgBody;}//图片类型else if (msg.msgType == IMMsgTypePic){ [UMSocialData defaultData].extConfig.wxMessageType = UMSocialWXMessageTypeImage;IMPicMsg *picMsg = [sender object];NSString *path = picMsg.originPicLocalPath;image = [UIImage imageWithContentsOfFile:path];}[UMSocialSnsService presentSnsIconSheetView:self appKey:IMShareMsgUMKey shareText:text shareImage:image shareToSnsNames:[NSArray arrayWithObjects:UMShareToSina,UMShareToWechatSession,UMShareToWechatTimeline,UMShareToRenren,nil] delegate:nil];
}
// [[UMSocialControllerService defaultControllerService] setShareText:@”底层接口分享测试” shareImage:nil socialUIDelegate:self];
// //设置分享内容和回调对象
// [UMSocialSnsPlatformManager getSocialPlatformWithName:UMShareToWechatTimeline].snsClickHandler(self,[UMSocialControllerService defaultControllerService],YES);
// UMSocialUrlResource *urlResource = [[UMSocialUrlResource alloc] initWithSnsResourceType:UMSocialUrlResourceTypeDefault url:@”http://www.baidu.com“];
// [[UMSocialDataService defaultDataService] postSNSWithTypes:@[UMShareToWechatTimeline] content:@”test test” image:nil location:nil urlResource:urlResource presentedController:self completion:^(UMSocialResponseEntity *response){
// if (response.responseCode == UMSResponseCodeSuccess) {
// NSLog(@”分享成功!”);
// }
// }];
- ios 分享功能 集成友盟分享
- ios 分享功能 集成友盟分享
- 分享功能 集成友盟分享
- 友盟分享 之新浪分享注意事项
- android分享 ------ 友盟分享(续)
- 友盟社会化分享 自定义分享页面
- 友盟分享 分享图片给QQ
- iOS 友盟分享
- 友盟分享接入
- 友盟分享
- 友盟分享
- 关于友盟分享
- 友盟分享SDK
- 友盟分享
- 友盟分享配置
- 友盟分享
- 友盟社会化分享
- 友盟分享问题
- 关于.net MVC中主视图和分部视图的数据共享遇到的问题
- LeetCode 332. Reconstruct Itinerary
- Drupal的工作原理
- iOS开发 常用的十种数据结构
- 在多叉树中查找某个节点及其拓展思考
- 友盟分享
- c3p0连接池需要关闭连接么
- 算法基础 - RMQ-ST算法(在线算法)
- VMWare中Linux虚拟机设置静态IP上网的设置方法
- swift版QQ音乐播放器(一)
- 短网址知识
- Ubuntu14.04下JDK8+Tomcat7 环境配置
- Android 制作简易浏览器源码
- NYOJ-18-The Triangle