- (void)initializePlat
{
//添加新浪微博应用
[ShareSDK connectSinaWeiboWithAppKey:@"3201194191"
appSecret:@"0334252914651e8f76bad63337b3b78f"
redirectUri:@"http://appgo.cn"];
//添加腾讯微博应用
[ShareSDK connectTencentWeiboWithAppKey:@"801307650"
appSecret:@"ae36f4ee3946e1cbb98d6965b0b2ff5c"
redirectUri:@"http://www.sharesdk.cn"];
//添加QQ空间应用
[ShareSDK connectQZoneWithAppKey:@"100371282"
appSecret:@"aed9b0303e3ed1e27bae87c33761161d"];
//添加微信应用
[ShareSDK connectWeChatWithAppId:@"wx460cdac783d396b1" wechatCls:[WXApi class]];
//添加QQ应用 100510022 QQ0F0A941E
[ShareSDK connectQQWithAppId:@"QQ0F0A941E" qqApiCls:[QQApi class]];
}
- (BOOL)application:(UIApplication *)application
handleOpenURL:(NSURL *)url
{
return [ShareSDK handleOpenURL:url
wxDelegate:self];
}
- (BOOL)application:(UIApplication *)application
openURL:(NSURL *)url
sourceApplication:(NSString *)sourceApplication
annotation:(id)annotation
{
return [ShareSDK handleOpenURL:url
sourceApplication:sourceApplication
annotation:annotation
wxDelegate:self];
}
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary*)launchOptions
{
//参数为ShareSDK官网中添加应用后得到的AppKey
[ShareSDK registerApp:@"10ce745008ef"];
[self initializePlat];
**************************************************************
#pragma mark - 分享
-(void)onShareSoftwear
{
NSLog(@"分享");
NSString *imagePath = [[NSBundle mainBundle] pathForResource:@"ShareSDK" ofType:@"jpg"];
//构造分享内容
id<ISSContent> publishContent = [ShareSDK content:@"广源铝业软件"
defaultContent:@"广源铝业"
image:[ShareSDK imageWithPath:imagePath]
title:@"广源铝业"
url:@"http://www.apple.com/itunes//us/app"
description:@"广源铝业下载"
mediaType:SSPublishContentMediaTypeNews];
//自己设置分享平台列表
NSNumber *sinaWeiBo=[NSNumber numberWithInt:ShareTypeSinaWeibo];
NSNumber *qqWeiBo=[NSNumber numberWithInt:ShareTypeTencentWeibo];
NSNumber *weiXinSpace=[NSNumber numberWithInt:ShareTypeWeixiTimeline];
NSArray * myShareList= [ShareSDKcustomShareListWithType:sinaWeiBo,qqWeiBo,weiXinSpace,nil];
//分享设置 就是分享面板上的某些内容的显示样式
id<ISSShareOptions> shareOptions =[ShareSDK defaultShareOptionsWithTitle:@"一键分享"
oneKeyShareList:nil
cameraButtonHidden:NO
mentionButtonHidden:NO
topicButtonHidden:NO
qqButtonHidden:YES
wxSessionButtonHidden:YES
wxTimelineButtonHidden:YES
showKeyboardOnAppear:NO
shareViewDelegate:nil
friendsViewDelegate:nil
picViewerViewDelegate:nil ];
[ShareSDK showShareActionSheet:nil
shareList:myShareList
content:publishContent
statusBarTips:YES
authOptions:nil
shareOptions: shareOptions
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], [errorerrorDescription]);
}
}];
}