一: 申请友盟的AppKey(友盟的Key是根据应用的名称生成的!)

在友盟注册了你自己的开发者账号后就可以申请AppKey了。然后在这个方法里面设置Key

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[UMSocialData setAppKey:@"*******************"];
//设置微信AppId、appSecret,分享url
[UMSocialWechatHandler setWXAppId:@"*******" appSecret:@"*******" url:@"http://www.umeng.com/social"];
//设置手机QQ 的AppId,Appkey,和分享URL,需要#import "UMSocialQQHandler.h"
[UMSocialQQHandler setQQWithAppId:@"*******" appKey:@"*******" url:@"http://www.umeng.com/social"];
}

这里就没有再设置SSO开关,按下面的步骤写下去也是没有问题的,能满足一般的需求;

二: 下面再通过下面的步骤路径

target---》 info -----》 URL Types  这个路径去设置自己的 URL Schemes 这里其实简单,可以看看官方的开发文档。

三:分享按钮参考代码

//***********************************************************************
//============================ 友盟分享
// 这里的分享没有设置SSO开关 新浪微博 和 腾讯微博 的客户端就没有发挥相应的作用,以后可以完善! NSString * FXContentString=[NSString stringWithFormat:@"%@%@",_storename,store_url];
UIAlertView * ALVIew=[[UIAlertView alloc]initWithTitle:@"提示" message:@"分享成功了" delegate:self cancelButtonTitle:@"确定" otherButtonTitles:nil, nil];
[SGActionView showGridMenuWithTitle:@"更多分享" itemTitles:@[ @"新浪微博", @"腾讯微博", @"微信", @"朋友圈",@"QQ", @"QQ空间", @"我信朋友圈"] images:@[ [UIImage imageNamed:@"分享_09"], [UIImage imageNamed:@"分享_11"], [UIImage imageNamed:@"分享_15"], [UIImage imageNamed:@"分享_05"], [UIImage imageNamed:@"分享_07"], [UIImage imageNamed:@"分享_13"], [UIImage imageNamed:@"分享_03"] ]selectedHandle:^(NSInteger index) { //******************* 新浪微博分享 这里的index相当于你按钮的tag值!!!!!
if (index==1) {
// 分享店铺名称和LOGO的生成网址
[[UMSocialControllerService defaultControllerService] setShareText:FXContentString shareImage:logo.image socialUIDelegate:self];
//设置分享内容和回调对象
[UMSocialSnsPlatformManager getSocialPlatformWithName:UMShareToSina].snsClickHandler(self,[UMSocialControllerService defaultControllerService],YES);
}
//******************** 腾讯微博分享
else if (index==2)
{
[[UMSocialDataService defaultDataService] postSNSWithTypes:@[UMShareToTencent] content:FXContentString image:logo.image location:nil urlResource:nil presentedController:self completion:^(UMSocialResponseEntity *shareResponse){
if (shareResponse.responseCode == UMSResponseCodeSuccess) {
[ALVIew show];
NSLog(@"分享成功!");
}
}];
}
//******************* 微信好友分享
else if (index==3)
{ //当分享消息类型为图文时,点击分享内容会跳转到预设的链接,设置方法如下
[UMSocialData defaultData].extConfig.wechatSessionData.url = store_url;
[UMSocialData defaultData].extConfig.wechatSessionData.title = _storename;
//使用UMShareToWechatSession,UMShareToWechatTimeline,UMShareToWechatFavorite分别代表微信好友、微信朋友圈、微信收藏
[[UMSocialDataService defaultDataService] postSNSWithTypes:@[UMShareToWechatSession] content:FXContentString image:logo.image location:nil urlResource:nil presentedController:self completion:^(UMSocialResponseEntity *response){
if (response.responseCode == UMSResponseCodeSuccess) {
NSLog(@"分享成功!");
}
}];
}
//*************** 微信朋友圈分享
else if (index==4)
{
//当分享消息类型为图文时,点击分享内容会跳转到预设的链接,设置方法如下
[UMSocialData defaultData].extConfig.wechatTimelineData.url = store_url;
[UMSocialData defaultData].extConfig.wechatTimelineData.title = _storename;
//使用UMShareToWechatSession,UMShareToWechatTimeline,UMShareToWechatFavorite分别代表微信好友、微信朋友圈、微信收藏
[[UMSocialDataService defaultDataService] postSNSWithTypes:@[UMShareToWechatTimeline] content:FXContentString image:logo.image location:nil urlResource:nil presentedController:self completion:^(UMSocialResponseEntity *response){
if (response.responseCode == UMSResponseCodeSuccess) { NSLog(@"分享成功!");
}
}];
}
//**************** QQ 好友分享
else if (index==5)
{
// QQ 分享到QQ好友设置分享内容点击的URL连接和标题
[UMSocialData defaultData].extConfig.qqData.title = _storename;
[UMSocialData defaultData].extConfig.qqData.url =store_url;
[[UMSocialDataService defaultDataService] postSNSWithTypes:@[UMShareToQQ] content:FXContentString image:logo.image location:nil urlResource:nil presentedController:self completion:^(UMSocialResponseEntity *response){
if (response.responseCode == UMSResponseCodeSuccess) {
NSLog(@"分享成功!");
}
}];
}
//**************** QQ 空间分享
else if (index==6)
{
// QQ 分享到QQ空间设置分享内容点击的URL连接和标题
[UMSocialData defaultData].extConfig.qzoneData.url = store_url;
[UMSocialData defaultData].extConfig.qzoneData.title = _storename;
[[UMSocialDataService defaultDataService] postSNSWithTypes:@[UMShareToQzone] content:FXContentString image:logo.image location:nil urlResource:nil presentedController:self completion:^(UMSocialResponseEntity *response){
if (response.responseCode == UMSResponseCodeSuccess) { NSLog(@"分享成功!");
}
}];
}
}
//=======================================================
//#############友盟分享

四:IOS 9.0 系统的问题

把你的info.plist 文档按文档格式打开,(选择文本编辑方式打开即可,鼠标右键)

复制粘贴下面代码

<key>LSApplicationQueriesSchemes</key> <array> <!-- 微信 URL Scheme 白名单--> <string>wechat</string> <string>weixin</string> <!-- 新浪微博 URL Scheme 白名单--> <string>sinaweibohd</string> <string>sinaweibo</string> <string>sinaweibosso</string> <string>weibosdk</string> <string>weibosdk2.5</string> <!-- QQ、Qzone URL Scheme 白名单--> <string>mqqapi</string> <string>mqq</string> <string>mqqOpensdkSSoLogin</string> <string>mqqconnect</string> <string>mqqopensdkdataline</string> <string>mqqopensdkgrouptribeshare</string> <string>mqqopensdkfriend</string> <string>mqqopensdkapi</string> <string>mqqopensdkapiV2</string> <string>mqqopensdkapiV3</string> <string>mqzoneopensdk</string> <string>wtloginmqq</string> <string>wtloginmqq2</string> <string>mqqwpa</string> <string>mqzone</string> <string>mqzonev2</string> <string>mqzoneshare</string> <string>wtloginqzone</string> <string>mqzonewx</string> <string>mqzoneopensdkapiV2</string> <string>mqzoneopensdkapi19</string> <string>mqzoneopensdkapi</string> <string>mqqbrowser</string> <string>mttbrowser</string> <!-- 人人 URL Scheme 白名单--> <string>renrenios</string> <string>renrenapi</string> <string>renren</string> <string>renreniphone</string> <!-- 来往 URL Scheme 白名单--> <string>laiwangsso</string> <!-- 易信 URL Scheme 白名单--> <string>yixin</string> <string>yixinopenapi</string> <!-- instagram URL Scheme 白名单--> <string>instagram</string> <!-- whatsapp URL Scheme 白名单--> <string>whatsapp</string> <!-- line URL Scheme 白名单--> <string>line</string> <!-- Facebook URL Scheme 白名单--> <string>fbapi</string> <string>fb-messenger-api</string> <string>fbauth2</string> <string>fbshareextension</string> </array>

格式可以看文档  http://dev.umeng.com/social/ios/ios9

最新文章

  1. ios移动端部分手机不支持background-attachment: fixed 的解决办法
  2. 改int非空自增列为int可为空列
  3. Codeforces Round #382 (Div. 2) 解题报告
  4. 【LeetCode】273. Integer to English Words
  5. MySQL Server 5.5安装中遇到的问题及解决方法
  6. js构造函数传参
  7. LDR伪指令与ADR伪指令的区别
  8. javascript 匿名函数的理解,js括号中括function 如(function(){})
  9. ini文件解析c库(iniparser)
  10. 十分钟搭建自己的hadoop2/CDH4集群
  11. jQuery插入节点的方法
  12. 一个php创建webservice,并通过c#调用的真实实例
  13. Skype无法显示登录界面
  14. 仿B站项目——(2)环境配置,文件目录
  15. idea tomcat上传图片,无法显示的问题解决
  16. jvm系列六、windows用jdk自带工具jps、jstack找出性能最差的代码
  17. MySQL 检索数据(SELECT)
  18. Dubbo原理实现之使用Javassist字节码结束构建代理对象
  19. 计算机基础知识 一 Basic knowledge of computers One
  20. 群晖NAS简介(转)

热门文章

  1. GIt-重置
  2. Android 获取当前应用的版本号+版本号比较
  3. Python中*和**的区别
  4. 编程高手解读什么是NodeJs?
  5. Aptana Studion出现 duplicate location重复定位报错
  6. Python+Selenium中级篇之-封装一个自己的类-浏览器引擎类
  7. Python学习-day14-前台总结
  8. Spring boot 整合jsp、thymeleaf、freemarker
  9. Python多进程之multiprocessing模块和进程池的实现
  10. Python面向对象之常用的特殊方法(5)