xml地图|网站地图|网站标签 [设为首页] [加入收藏]

ShareSDK分享微博的问题,使用ShareSDK实现分享功能

来源:http://www.ccidsi.com 作者:最新解决方案 人气:61 发布时间:2020-04-05
摘要:是因为当年一向不用markdown编写,文章有一点乱,将来再次编辑了一晃,假设有亟待,能够看那么些使用ShareSDK达成分享功用 在有图片链接的时候,分享到博客园,不像qq/Wechat那样直接

是因为当年一向不用markdown编写,文章有一点乱,将来再次编辑了一晃,假设有亟待,能够看那么些使用ShareSDK达成分享功用

在有图片链接的时候,分享到博客园,不像qq/Wechat那样直接带有链接,链接必得加到text里面,所以在确定保证弹出sheet的还要,将新浪天涯论坛的享受内容和其余平台区分开。

//sharesdk idk

将内容分享到别的平台是个十一分普及的法力,明日和大家大吃大喝一下,怎样用ShareSDK完结分享到Wechat亲密的朋友、微信收藏、微信交际圈、QQ、QQ空间、影像笔记以致复制的功用。首先,大家需求去各类社交平台报名对应的应用程式Key,各种平台的网站汇总可参看: ShareSDK各社交平台申请应用程式key 的网站及报名流程汇总 。之后,大家导入ShareSDK的库。

图片 1

//腾讯idk

用pod导入。

不说了,贴代码

#import TencentOpenAPI/TencentOAuth.h

在Pod file中添加

//创造分享的参数

#import TencentOpenAPI/QQApiInterface.h

```

NSArray * imgArr = @[@"];

#import "WXApi.h"

pod 'ShareSDK3'pod 'MOBFoundation'pod 'ShareSDK3/ShareSDKUI'pod 'ShareSDK3/ShareSDKPlatforms/QQ'pod 'ShareSDK3/ShareSDKPlatforms/SinaWeibo'pod 'ShareSDK3/ShareSDKPlatforms/WeChat'

if (imgArr) {

#import "WeiboSDK.h"

```

NSMutableDictionary * shareDic  = [NSMutableDictionary dictionary];

#import "ShareButton.h"

中间pod 'ShareSDK3' pod 'MOBFoundation'是必得的,别的的依据需求相应的拉长,比如,假使您供给利用ShareSDK的UI,那么你就需求导入pod 'ShareSDK3/ShareSDKUI',然后供给分享到哪些社交平台就增多相应的阳台。盘算职业搞好后大家就足以开展落到实处了。

[shareDic SSDKEnableUseClientShare];

@interface ShareModel : NSObject

1、在AppDelegate中程导弹入头文件

NSString * text = @"诚邀亲密的朋友注册有表彰哦~";

@property (nonatomic ,strong) NSString    *picUrl;

```

NSString * content = [NSString stringWithFormat:@"%@%@",text,_urlstr];

@property (nonatomic ,strong) NSString    *title;

#import<ShareSDK/ShareSDK.h>

[shareDic SSDKSetupShareParamsByText:  text 

@property (nonatomic ,strong) NSString    *content;

#import<WXApi.h>

 images:imgArr url:[NSURL URLWithString:_urlstr] title:@"一齐来啊!" type:SSDKContentTypeAuto];

@property (nonatomic ,strong) NSString    *link;

#import<ShareSDKConnector/ShareSDKConnector.h>

[shareDic SSDKSetupSinaWeiboShareParamsByText:content 

@end

#import<TencentOpenAPI/QQApiInterface.h>

title:@"一齐来吧!" image:imgArr url:[NSURL URLWithString:_urlstr] latitude:0.0 longitude:0.0 objectID:nil type:SSDKContentTypeAuto];

@interface YZShare : NSObject

#import<TencentOpenAPI/TencentOAuth.h>

//分享

//注册分享组件

#import<WeiboSDK.h>

[ShareSDK showShareActionSheet:nil items:nil shareParams:shareDic onShareStateChanged:^(SSDKResponseState state, SSDKPlatformType platformType, NSDictionary *userData, SSDKContentEntity *contentEntity, NSError *error, BOOL end) {

(void)registApp;

```

switch (state) {

@end

2、在- application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *卡塔尔(قطر‎launchOptions;中早先化ShareSDK

case SSDKResponseStateSuccess:

//分享分界面

[ShareSDK registerApp:@"AppKey" activePlatforms:@[@(SSDKPlatformSubTypeWechatSession),@(SSDKPlatformSubTypeWechatTimeline),@(SSDKPlatformSubTypeWechatFav),@(SSDKPlatformTypeSinaWeibo), @(SSDKPlatformTypeQQ),@(SSDKPlatformTypeYinXiang),@(SSDKPlatformSubTypeQZone), @(SSDKPlatformTypeCopy)] onImport:^(SSDKPlatformType platformType) {

{

typedef void(^SelectShareTypeBlock)(SSDKPlatformType platfromType ,NSInteger name);

switch (platformType) {

UIAlertView * alertview = [[UIAlertView alloc] initWithTitle:@"分享成功" message:nil delegate:nil cancelButtonTitle:@"鲜明" otherButtonTitles:nil, nil];

@interface YZShareView :       UIView

case SSDKPlatformTypeWechat: {

[alertview  show];

@property (nonatomic ,retain)  UIVisualEffectView *blurView;

[ShareSDKConnector connectWeChat:[WXApi class]];

}

@property (nonatomic ,copy)    SelectShareTypeBlock selectTypeBlock;

}

break;

@property (nonatomic ,strong)  UIView *whiteView;

break;

case SSDKResponseStateFail:

@end

case SSDKPlatformTypeQQ: {

{

//阴影分界面

[ShareSDKConnector connectQQ:[QQApiInterface class] tencentOAuthClass:[TencentOAuth class]];

NSLog(@"%@",error);

@interface ShareViewbg : UIView

}

UIAlertView * alertview = [[UIAlertView alloc] initWithTitle:@"分享失利" message:[NSString stringWithFormat:@"%@",error] delegate:nil cancelButtonTitle:@"ok" otherButtonTitles:nil, nil];

- (instancetype)initWithFrame:(CGRect)frame shareModel:(ShareModel *)shareModel;

break;

[alertview show];

@property (nonatomic ,copy) void(^SSDKResponseStateSuccess)(NSUInteger indexId);

default:

}

@property (nonatomic ,copy) void(^SSDKResponseStateFail)(NSString *error);

break;

break;

@property (nonatomic ,copy) void(^SSDKResponseStateCancel)();

}

default:

@property (nonatomic ,copy) void(^dimissShareView)();

} onConfiguration:^(SSDKPlatformType platformType, NSMutableDictionary *appInfo) {

break;

@property (nonatomic ,strong) YZShareView *shareView;

switch (platformType) {

}

@property (nonatomic ,strong) UIView      *bgView;

case SSDKPlatformTypeSinaWeibo: {

}];

@end

[appInfo SSDKSetupSinaWeiboByAppKey:@"sinaAppKey" appSecret:@"apply对应的密码" redirectUri:@"" authType:SSDKAuthTypeBoth];

}

#import "YZShare.h"

}

#import "MyConst.h" //导入宏

break;

@interface YZShareView ()

case SSDKPlatformTypeWechat: {

@end

[appInfo SSDKSetupWeChatByAppId:@"Wechatappkey" appSecret:@"Wechatapply对应的密码"];

@implementation YZShare

}

/**

break;

*最初化应用

case SSDKPlatformTypeQQ: {

*/

[appInfo SSDKSetupQQByAppId:@"QQappID" appKey:@"QQappkey" authType:SSDKAuthTypeSSO];

(void)registApp{

}

[ShareSDK registerApp:@"*********" activePlatforms:@[@(SSDKPlatformSubTypeWechatTimeline),

break;

@(SSDKPlatformSubTypeWechatSession),

case SSDKPlatformTypeYinXiang:

@(SSDKPlatformTypeSinaWeibo),

[appInfo SSDKSetup伊夫rnoteByConsumerKey:@"影象笔记appkey" consumerSecret:@"影象笔记appkey对应的密码" sandbox:NO];

@(SSDKPlatformSubTypeQQFriend),

break;

@(SSDKPlatformSubTypeQZone),

default:

@(SSDKPlatformTypeCopy)

break;

]

}

onImport:^(SSDKPlatformType platformType) {

}];`

switch (platformType) {

此地需求注意的三个地方是影像笔记分享中的sandbox参数,如若在测量试验阶段,把参数设成YES,也等于应用沙箱情形;假使项目要上传AppStore了将其改成NO.在沙箱情状下,分享成功后在影象笔记的顾客端是看不到已经享受的内容的,供给到影象笔记的沙箱遭遇(

case SSDKPlatformTypeWechat:

2.增多跳转白名单。

[ShareSDKConnector connectWeChat:[WXApi class]];

右击plist文件,用source code的章程展开,如图

break;

下一场步向如下图所示的代码

case SSDKPlatformTypeQQ:

图片 2

[ShareSDKConnector connectQQ:[QQApiInterface class] tencentOAuthClass:[TencentOAuth class]];

抑或也得以在plist文件中用key type value的法子丰裕,如下图

break;

图片 3

case SSDKPlatformTypeSinaWeibo:

3.将bit code关掉

[ShareSDKConnector connectWeibo:[WeiboSDK class]];

图片 4

break;

4、设置各样平台的UTiggoL Types

case SSDKPlatformTypeCopy:

图片 5微信的URL Schemes图片 6QQ 的URL Schemes图片 7乐乎或许推特(Twitter卡塔尔(قطر‎的 UQX56L Schemes

{

5、添加-ObjC支持。如图

}

图片 8-ObjC支持

break;

6、在须要分享的地点,达成分享方法。

case SSDKPlatformSubTypeQQFriend:

NSMutableDictionary *shareParams = [NSMutableDictionary dictionary];

{

享用的参数有:shareContent、shareLink、shareTitle、netImageUrl(网络图片,给二个USportageL地址就可以,若要分享本地图片,接纳[UIImage imageNamed:@""])

}

1.//要是持有平台要享受的内容一成不改变,可径直行使

break;

`[shareParams SSDKSetupShareParamsByText:[NSString stringWithFormat:@"%@%@", shareContent, [NSURL URLWithString:shareLink]]

case SSDKPlatformSubTypeQZone:

images:netImageUrl

{

url:[NSURL URLWithString:shareLink]

[ShareSDKConnector connectQQ:[QQApiInterface class] tencentOAuthClass:[TencentOAuth class]];

title:shareTitle

}

type:SSDKContentTypeAuto];`

break;

2、倘若想自定义种种平台的分享内容,则用其对应的API

default:

// Wechat生活圈

break;

`[shareParams SSDKSetupWeChatParamsByText:[NSString stringWithFormat:@"%@%@", shareContent, [NSURL URLWithString:shareLink]] title:shareTitle url:[NSURL URLWithString:shareLink] thumbImage:nil image:[UIImage imageNamed:@"60x60@2x"] musicFileURL:nil extInfo:nil fileData:nil emoticonData:nil type:SSDKContentTypeAuto forPlatformSubType:SSDKPlatformSubTypeWechatSession];`

}

// Wechat收藏

} onConfiguration:^(SSDKPlatformType platformType, NSMutableDictionary *appInfo) {

`[shareParams SSDKSetupWeChatParamsByText:[NSString stringWithFormat:@"%@", shareContent] title:shareTitle url:nil thumbImage:nil image:[UIImage imageNamed:@"60x60@2x"] musicFileURL:nil extInfo:nil fileData:nil emoticonData:nil type:SSDKContentTypeAuto forPlatformSubType:SSDKPlatformSubTypeWechatFav];`

switch (platformType) {

// Wechat好朋友

case SSDKPlatformTypeSinaWeibo:

`[shareParams SSDKSetupWeChatParamsByText:[NSString stringWithFormat:@"%@", shareContent] title:shareTitle url:[NSURL URLWithString:shareLink] thumbImage:nil image:[UIImage imageNamed:@"60x60@2x"] musicFileURL:nil extInfo:nil fileData:nil emoticonData:nil type:SSDKContentTypeAuto forPlatformSubType:SSDKPlatformSubTypeWechatTimeline];`

[appInfo SSDKSetupSinaWeiboByAppKey:@"********"

// 博客园天涯论坛,分享到今日头条的标题及UXC90L需拼接到内容里,单独放在对应的参数里倒霉使。

appSecret:@"****************"

`[shareParams SSDKSetupSinaWeiboShareParamsByText:[NSString stringWithFormat:@"%@%@",shareTitle, shareContent, [NSURL URLWithString:shareLink]] title:shareTitle image:netImageUrl url:[NSURL URLWithString:shareLink] latitude:0 longitude:0 objectID:nil type:SSDKContentTypeAuto];`

redirectUri:@"https:********"

// QQ好友

authType:SSDKAuthTypeBoth];

`[shareParams SSDKSetupQQParamsByText:[NSString stringWithFormat:@"%@", shareTitle] title:nil url:[NSURL URLWithString:shareLink] thumbImage:nil image:netImageUrl type:SSDKContentTypeAuto forPlatformSubType:SSDKPlatformTypeQQ];`

break;

// QQ空间

case SSDKPlatformTypeWechat:

`[shareParams SSDKSetupQQParamsByText:[NSString stringWithFormat:@"%@", shareTitle] title:nil url:[NSURL URLWithString:shareLink] thumbImage:nil image:netImageUrl type:SSDKContentTypeAuto forPlatformSubType:SSDKPlatformSubTypeQZone];`

case SSDKPlatformSubTypeWechatSession:

// 影像笔记

case SSDKPlatformSubTypeWechatTimeline:

`[shareParams SSDKSetupEvernoteParamsByText:[NSString stringWithFormat:@"%@ %@",shareTitle ,shareContent,shareLink] images:netImageUrl

case SSDKPlatformSubTypeWechatFav:

title:shareTitle notebook:nil tags:nil platformType:SSDKPlatformTypeYinXiang];`

[appInfo SSDKSetupWeChatByAppId:@"********"

// 复制

appSecret:@"********"];

`[shareParams SSDKSetupCopyParamsByText:nil images:nil url:[NSURL URLWithString:shareLink] type:SSDKContentTypeAuto];`

break;

//分享分界面,items中的平台的逐条能够调解

case SSDKPlatformSubTypeQQFriend:

`SSUIShareActionSheetController *sheet = [ShareSDK showShareActionSheet:nil

case SSDKPlatformTypeQQ:

items:@[@(SSDKPlatformSubTypeWechatSession),

case SSDKPlatformSubTypeQZone:

@(SSDKPlatformSubTypeWechatTimeline),

[appInfo SSDKSetupQQByAppId:@"********"

@(SSDKPlatformSubTypeWechatFav),

appKey:@"A********"

@(SSDKPlatformTypeSinaWeibo),

authType:SSDKAuthTypeBoth];

本文由68399皇家赌场发布于最新解决方案,转载请注明出处:ShareSDK分享微博的问题,使用ShareSDK实现分享功能

关键词: 68399皇家赌场 日记 功能 ShareSDK iOS相关

上一篇:ios开源项目0316,iOS开源项目周报0413

下一篇:没有了

最火资讯