参照官网的文档http://wiki.sharesdk.cn/iOS快速集成指南
这里记录一下如何分享
NSString *imagePath = [[NSBundle mainBundle] pathForResource:@"friend_website_img" ofType:@"png"];
//这里只是测试,图片不要过大,过大要变小一点,这里选择的图片是5k的图片
UIImage *shareImage = [UIImage imageWithContentsOfFile:imagePath];
//定义分享图片
id<ISSCAttachment> publishImage = nil;
publishImage = [ShareSDK jpegImageWithImage:shareImage quality:1.0f];
id<ISSContent> pushlishContent = [ShareSDK content:@"我要分享"
defaultContent:@"默认分享内容,没内容的时候显示"
image:publishImage
title:@"share Sdk"
url:imageStr
description:@"这是一条测试信息"
mediaType:SSPublishContentMediaTypeNews];//类型,文字,图片,文字加图片是news
//直接分享,
[ShareSDK shareContent:pushlishContent
type:ShareTypeWeixiSession //分享到微信, 可以选, 枚举类型
authOptions:nil
statusBarTips:YES
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]);
}
}];
//这个是弹出 ActionSheet选择分享到哪个平台
/*
[ShareSDK showShareActionSheet:nil
shareList:nil
content:pushlishContent
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]);
}
}];
*/