//新浪微博: //App Key:2258477553 //App Secret:1e2f275afc375109e456f550fb3918e8 //騰訊微博: //App key:2620460989 //App secret:58c55f572d5ae35e0c355f4c0ee11283
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { //註冊ShareSDK [ShareSDK registerApp:@"1983bf0916db」]; return YES; }
注意: 新浪微博須要提供回調地址才行php
回調地址去新浪開發者平臺獲取app
如圖:工具
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { //註冊ShareSDK [ShareSDK registerApp:@"1983bf0916db」]; //添加新浪微博應用 [ShareSDK connectSinaWeiboWithAppKey:@"2620460989" appSecret:@"58c55f572d5ae35e0c355f4c0ee11283" redirectUri:@"http://weibo.cn/ext/share?ru=http%3A%2F%2F16kxs.com%2Fwap%2FBook%2FShow.aspx%3Fid%3D7983%26lmid%3D0%26uid%3D0%26ups%3D0&rt=%E9%83%BD%E5%B8%82%E7%89%A7%E9%AC%BC%E4%BA%BA&st=1301645308&appkey=2620460989」]; //添加騰訊微博應用 [ShareSDK connectTencentWeiboWithAppKey:@"801307650" appSecret:@"ae36f4ee3946e1cbb98d6965b0b2ff5c" redirectUri:@"http://www.sharesdk.cn"]; //添加豆瓣應用 [ShareSDK connectDoubanWithAppKey:@"07d08fbfc1210e931771af3f43632bb9" appSecret:@"e32896161e72be91" redirectUri:@"http://dev.kumoway.com/braininference/infos.php"]; //添加人人網應用 [ShareSDK connectRenRenWithAppKey:@"fc5b8aed373c4c27a05b712acba0f8c3" appSecret:@"f29df781abdd4f49beca5a2194676ca4"]; //添加Facebook應用 [ShareSDK connectFacebookWithAppKey:@"107704292745179" appSecret:@"38053202e1a5fe26c80c753071f0b573"]; }
a.初始化默認分享內容測試
NSString *imagePath = [[NSBundle mainBundle] pathForResource:@"123" ofType:@"png"]; //構建優秀的SDK //構造分享內容 id<ISSContent> publishContent = [ShareSDK content:@"iOS社交化分享測試內容。" defaultContent:@"默認分享內容,沒內容時顯示" image:[ShareSDK imageWithPath:imagePath] title:@"ShareSDK" url:@"http://www.sharesdk.cn" description:@"這是一條測試信息" mediaType:SSPublishContentMediaTypeNews];
b.彈出分享View網站
[ShareSDK showShareActionSheet:nil shareList:nil content:publishContent statusBarTips:YES authOptions:nil shareOptions: nil result:^(ShareType type, SSResponseState state, id<ISSPlatformShareInfo> statusInfo, id<ICMErrorInfo> error, BOOL end) { if (state == SSResponseStateSuccess) { NSLog(@"分享成功"); } else if (state == SSResponseStateFail) { NSLog(@"分享失敗,錯誤碼:%d,錯誤描述:%@", [error errorCode], [error errorDescription]); } }];
效果圖:ui
做者: 清澈Saup
出處: http://www.cnblogs.com/qingche/
本文版權歸做者和博客園共有,歡迎轉載,但必須保留此段聲明,且在文章頁面明顯位置給出原文鏈接。url