一: 申請友盟的AppKey(友盟的Key是根據應用的名稱生成的!)ios
在友盟註冊了你本身的開發者帳號後就能夠申請AppKey了。而後在這個方法裏面設置Keyapi
- (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開關,按下面的步驟寫下去也是沒有問題的,能知足通常的需求;微信
二: 下面再經過下面的步驟路徑app
target---》 info -----》 URL Types 這個路徑去設置本身的 URL Schemes 這裏其實簡單,能夠看看官方的開發文檔。iphone
三:分享按鈕參考代碼post
//*********************************************************************** //============================ 友盟分享 // 這裏的分享沒有設置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 系統的問題url
把你的info.plist 文檔按文檔格式打開,(選擇文本編輯方式打開便可,鼠標右鍵)spa
複製粘貼下面代碼orm
<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</