导人ShareSDK 。视图一键分享 加入如下代码 ,设置ActionSheet代理
如果不需要一键分享可以传入nil,默认一键分享列表则可以传入[NSArraydefaultOneKeyShareList]参数。
- (void)oneKeyShareButtonClickHandler:(UIButton *)sender
{
//定制一键分享列表
NSArray *shareList = [ShareSDK getShareListWithType: ShareTypeSinaWeibo, ShareTypeTencentWeibo,nil];
id<ISSPublishContent> publishContent = [ShareSDK publishContent:CONTENT
defaultContent:@""
image:[UIImage imageNamed:IMAGE_NAME]
imageQuality:0.8
mediaType:SSPublishContentMediaTypeNews
title:@"ShareSDK"
url:@"http://www.sharesdk.cn"
musicFileUrl:nil
extInfo:nil
fileData:nil];
[ShareSDK showShareActionSheet:self
iPadContainer:[ShareSDK iPadShareContainerWithView:sender arrowDirect:UIPopoverArrowDirectionUp]
shareList:shareList
content:publishContent
statusBarTips:YES
convertUrl:YES //委托转换链接标识,YES:对分享链接进行转换,NO:对分享链接不进行转换,为此值时不进行回流统计。
authOptions:nil
shareViewOptions:[ShareSDK defaultShareViewOptionsWithTitle:@"分享内容"
oneKeyShareList:[NSArray defaultOneKeyShareList]
qqButtonHidden:YES
wxSessionButtonHidden:YES
wxTimelineButtonHidden:YES
showKeyboardOnAppear:YES]
result:^(ShareType type, SSPublishContentState state, id<ISSStatusInfo> statusInfo, id<ICMErrorInfo> error, BOOL end) {
if (state == SSPublishContentStateSuccess)
{
NSLog(@"分享成功");
}
else if (state == SSPublishContentStateFail)
{
NSLog(@"分享失败,错误码:%d,错误描述:%@", [error errorCode], [error errorDescription]);
}
}];
}
如果不需要一键分享可以传入nil,默认一键分享列表则可以传入[NSArraydefaultOneKeyShareList]参数。