标签:des style class blog code http
http://www.cnblogs.com/qingche/p/3727559.html
//新浪微博: //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; }
注意: 新浪微博需要提供回调地址才行
回调地址去新浪开发者平台获取
如图:
- (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]); } }];
效果图:
出处: http://www.cnblogs.com/qingche/
iOS- 三步快速集成社交化分享工具ShareSDK,布布扣,bubuko.com
标签:des style class blog code http
原文地址:http://www.cnblogs.com/yangmx/p/3805747.html