- + (void)shareWithContent:(NSString *)content
- pngImage:(UIImage *)pngImage
- title:(NSString *)title
- url:(NSString *)url
- mediaType:(SSPublishContentMediaType)mediaType
- shareViewDelegate:(id<ISSShareViewDelegate>)shareViewDelegate
- completion:(HYBShareCompletion)completion {
- // 定义分享列表
- NSArray *shareList = [ShareSDK customShareListWithType:
- SHARE_TYPE_NUMBER(ShareTypeWeixiSession),
- SHARE_TYPE_NUMBER(ShareTypeWeixiTimeline),
- SHARE_TYPE_NUMBER(ShareTypeQQ),
- SHARE_TYPE_NUMBER(ShareTypeQQSpace),
- nil nil];
-
- // 分享内容
- id<ISSContent> sharedContent = [ShareSDK content:content
- defaultContent:content
- image:[ShareSDK pngImageWithImage:pngImage]
- title:title
- url:url
- description:@"看不懂,就是你的错"
- mediaType:mediaType];
- [sharedContent addWeixinSessionUnitWithType:INHERIT_VALUE
- content:INHERIT_VALUE
- title:INHERIT_VALUE
- url:INHERIT_VALUE
- thumbImage:[ShareSDK pngImageWithImage:pngImage]
- image:INHERIT_VALUE
- musicFileUrl:nil
- extInfo:nil
- fileData:nil
- emoticonData:nil];
-
- [sharedContent addWeixinTimelineUnitWithType:[NSNumber numberWithInteger:SSPublishContentMediaTypeNews]
- content:INHERIT_VALUE
- title:content
- url:INHERIT_VALUE
- thumbImage:[ShareSDK pngImageWithImage:pngImage]
- image:INHERIT_VALUE
- musicFileUrl:nil
- extInfo:nil
- fileData:nil
- emoticonData:nil];
-
- [sharedContent addQQUnitWithType:INHERIT_VALUE
- content:INHERIT_VALUE
- title:INHERIT_VALUE
- url:INHERIT_VALUE
- image:INHERIT_VALUE];
-
- // 验证参数
- id<ISSAuthOptions> authOptions = [ShareSDK authOptionsWithAutoAuth:YES
- allowCallback:NO
- authViewStyle:SSAuthViewStyleFullScreenPopup
- viewDelegate:nil
- authManagerViewDelegate:nil];
-
-
- // 如果是使用一键分享,则需要传oneKeyShareList参数,
- // 如果使用的是自定义的分享菜单,则这个参数需要设置为nil,
- // 否则会出现
- id<ISSShareOptions> shareOptions = [ShareSDK defaultShareOptionsWithTitle:@"我是标哥"
- oneKeyShareList:nil
- qqButtonHidden:YES
- wxSessionButtonHidden:YES
- wxTimelineButtonHidden:YES
- showKeyboardOnAppear:NO
- shareViewDelegate:shareViewDelegate
- friendsViewDelegate:nil
- picViewerViewDelegate:nil];
-
- [ShareSDK showShareActionSheet:nil
- shareList:shareList
- content:sharedContent
- statusBarTips:YES
- authOptions:authOptions
- shareOptions:shareOptions
- result:^(ShareType type, SSResponseState state, id<ISSPlatformShareInfo> statusInfo, id<ICMErrorInfo> error, BOOL end) {
- NSLog(@"%d", type);
- if (end) {
- if (completion) {
- completion(SSResponseStateSuccess == state);
- }
- }
- }];
- return;
- }
iOS学习代码下载—ShareSDK分享到微信、微信朋友圈、QQ
最新推荐文章于 2023-01-04 16:02:31 发布