iOS-三步快速集成社交化分享工具ShareSDK
|
- (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"];
}
|
|
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];
|
|
[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]);
}
}];
|

