在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称:MobClub/ShareSDK-for-iOS开源软件地址:https://github.com/MobClub/ShareSDK-for-iOS开源编程语言:Objective-C 97.8%开源软件介绍:ShareSDK For iOS文档语言 : 中文 | English 概述
当前版本更新(4.4.6)更新说明: 1.修复google+新用户授权异常问题 当前版本更新(4.4.5)更新说明: 1.修复messenger,whatsapp分享bug 当前版本更新(4.4.4)更新说明: 1.修复Facebook首次分享不成功的bug 当前版本更新(4.4.3)更新说明: 1.修复facebook,钉钉,evernote,Youtube,Telegram,LinkedIn,VK平台分享异常问题 2.修复5G网络报错问题 3.snapchat,抖音,kakao,微信,qq,facebook,钉钉,企业微信等第三方SDK更新 当前版本更新(4.4.2)更新说明: 1.Line文字分享改为新的接口 2.Tumblr新增分享链接、音频、视频 3.Reddit新增分享图片 当前版本更新(4.4.1)更新说明: 1.钉钉SDK更新,新增支持APP授权 2.Tik TokSDK更新,新增支持授权功能 3.新增支持分享图片、链接到抖音IM 4.微信授权新增state校验(以时间戳的形式设置state),防止被第三方伪造信息 5.口令分享功能问题修复 当前版本更新(4.4.0)更新说明:
当前版本更新(4.3.17)更新说明:
当前版本更新(4.3.16)更新说明:
当前版本更新(4.3.15)更新说明:
当前版本更新(4.3.11)更新说明:
一、获取AppKey如何在我们的官网注册应用得到appkey,请点击 链接 看里面的操作步骤。 二、快速集成下面是使用Cocoapods集成方式,另一种通过官方下载相关Framework直接集成 下载地址。 ShareSDK支持使用Cocoapods集成,请按需在Podfile文件中添加以下语句:
三、在使用pod集成过程中以下为可能出现的问题及解决方案
四、项目中配置及如何使用ShareSDK第一步:设置ShareSDK的Appkey并初始化对应的第三方社交平台在项目工程的Info.plist 中如图增加 MOBAppkey 和 MOBAppSecret 两个字段
打开*AppDelegate.m(*代表你的工程名字)导入头文件 #import <ShareSDK/ShareSDK.h> 在- (BOOL)application: didFinishLaunchingWithOptions:方法中调用registerApp方法来初始化SDK并且初始化第三方平台(各社交平台申请AppKey的网址及申请流程汇总) - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
[ShareSDK registPlatforms:^(SSDKRegister *platformsRegister) {
//QQ
[platformsRegister setupQQWithAppId:@"100371282" appkey:@"aed9b0303e3ed1e27bae87c33761161d"];
//微信
[platformsRegister setupWeChatWithAppId:@"wx617c77c82218ea2c" appSecret:@"c7253e5289986cf4c4c74d1ccc185fb1"];
//新浪
[platformsRegister setupSinaWeiboWithAppkey:@"568898243" appSecret:@"38a4f8204cc784f81f9f0daaf31e02e3" redirectUrl:@"http://www.sharesdk.cn"];
//Facebook
[platformsRegister setupFacebookWithAppkey:@"1412473428822331" appSecret:@"a42f4f3f867dc947b9ed6020c2e93558" displayName:@"shareSDK"];
//Twitter
[platformsRegister setupTwitterWithKey:@"viOnkeLpHBKs6KXV7MPpeGyzE" secret:@"NJEglQUy2rqZ9Io9FcAU9p17omFqbORknUpRrCDOK46aAbIiey" redirectUrl:@"http://mob.com"];
//Instagram
[platformsRegister setupInstagramWithClientId:@"ff68e3216b4f4f989121aa1c2962d058" clientSecret:@"1b2e82f110264869b3505c3fe34e31a1" redirectUrl:@"http://sharesdk.cn"];
//钉钉
[platformsRegister setupDingTalkWithAppId:@"dingoabcwtuab76wy0kyzo"];
//支付宝
[platformsRegister setupAliSocialWithAppId:@"2017062107540437"];
//豆瓣
[platformsRegister setupDouBanWithApikey:@"02e2cbe5ca06de5908a863b15e149b0b" appSecret:@"9f1e7b4f71304f2f" redirectUrl:@"http://www.sharesdk.cn"];
//Dropbox
[platformsRegister setupDropboxWithAppKey:@"us514wslpfojbxc" appSecret:@"w0nmp4os3ngo1ja" redirectUrl:@"http://localhost"];
//易信
[platformsRegister setupYiXinByAppId:@"yx0d9a9f9088ea44d78680f3274da1765f" appSecret:@"1a5bd421ae089c3" redirectUrl:@"https://open.yixin.im/resource/oauth2_callback.html"];
//Flickr
[platformsRegister setupFlickrWithApiKey:@"cbed81d4a1bc7417693ab7865e354717" apiSecret:@"4c490343869091f2"];
//Instapaper
[platformsRegister setupInstapaperWithConsumerKey:@"4rDJORmcOcSAZL1YpqGHRI605xUvrLbOhkJ07yO0wWrYrc61FA" consumerSecret:@"GNr1GespOQbrm8nvd7rlUsyRQsIo3boIbMguAl9gfpdL0aKZWe"];
//Line
[platformsRegister setupLineAuthType:SSDKAuthorizeTypeBoth];
//YinXiang
[platformsRegister setupEvernoteByConsumerKey:@"46131514-6903" consumerSecret:@"08d7a6f3afcc888a" sandbox:YES];
//Evernote
[platformsRegister setupEvernoteByConsumerKey:@"46131514-6903" consumerSecret:@"08d7a6f3afcc888a" sandbox:YES];
//kakao
[platformsRegister setupKaKaoWithAppkey:@"9c17eb03317e0e627ec95a400f5785fb" restApiKey:@"802e551a5048c3172fc1dedaaf40fcf1" redirectUrl:@"http://www.mob.com/oauth"];
//VKontakte
[platformsRegister setupVKontakteWithApplicationId:@"5312801" secretKey:@"ZHG2wGymmNUCRLG2r6CY" authType:SSDKAuthorizeTypeBoth];
//YouTube
[platformsRegister setupYouTubeWithClientId:@"906418427202-jinnbqal1niq4s8isbg2ofsqc5ddkcgr.apps.googleusercontent.com" clientSecret:@"" redirectUrl:@"http://localhost"];
//美拍
[platformsRegister setupMeiPaiWithAppkey:@"1089867639"];
//腾讯微博
[platformsRegister setupTencentWeiboWithAppkey:@"801307650" appSecret:@"ae36f4ee3946e1cbb98d6965b0b2ff5c" redirectUrl:@"http://www.sharesdk.cn"];
//人人网
[platformsRegister setupRenRenWithAppId:@"226427" appKey:@"fc5b8aed373c4c27a05b712acba0f8c3" secretKey:@"f29df781abdd4f49beca5a2194676ca4" authType:SSDKAuthorizeTypeBoth];
//CMCC
[platformsRegister setupCMCCByAppId:@"300011862498" appKey:@"38D9CA1CC280C5F207E2C343745D4A4B" displayUI:YES];
//有道云笔记
[platformsRegister setupYouDaoNoteWithConsumerKey:@"dcde25dca105bcc36884ed4534dab940" consumerSecret:@"d98217b4020e7f1874263795f44838fe" oauthCallback:@"http://www.sharesdk.cn/"];
//明道
[platformsRegister setupMingDaoByAppKey:@"97230F25CA5C" appSecret:@"A5DC29AF7C5A5851F28E903AE9EAC0" redirectUrl:@"http://mob.com"];
//开心网
[platformsRegister setupKaiXinByApiKey:@"358443394194887cee81ff5890870c7c" secretKey:@"da32179d859c016169f66d90b6db2a23" redirectUrl:@"http://www.sharesdk.cn/"];
//Google+
[platformsRegister setupGooglePlusByClientID:@"351114257251-isfr7cnt5gop930krntpf246d9ofv8j5.apps.googleusercontent.com" clientSecret:@"" redirectUrl:@"http://localhost"];
//Pinterest
[platformsRegister setupPinterestByClientId:@"4987008320438021391"];
//Pocket
[platformsRegister setupPocketWithConsumerKey:@"11496-de7c8c5eb25b2c9fcdc2b627" redirectUrl:@"pocketapp1234"];
//LinkedIn
[platformsRegister setupLinkedInByApiKey:@"46kic3zr7s4n" secretKey:@"RWw6WRl9YJOcdWsj" redirectUrl:@"http://baidu.com"];
//Instapaper
[platformsRegister setupInstapaperWithConsumerKey:@"4rDJORmcOcSAZL1YpqGHRI605xUvrLbOhkJ07yO0wWrYrc61FA" consumerSecret:@"GNr1GespOQbrm8nvd7rlUsyRQsIo3boIbMguAl9gfpdL0aKZWe"];
//Tumblr
[platformsRegister setupTumblrByConsumerKey:@"2QUXqO9fcgGdtGG1FcvML6ZunIQzAEL8xY6hIaxdJnDti2DYwM" consumerSecret:@"3Rt0sPFj7u2g39mEVB3IBpOzKnM3JnTtxX2bao2JKk4VV1gtNo" redirectUrl:@"http://sharesdk.cn"];
//SMS
[platformsRegister setupSMSOpenCountryList:NO];
//Telegram
[platformsRegister setupTelegramByBotToken:@"600852601:AAElp9J93JiYevLocDIEYPhEYulnMFuB_nQ" botDomain:@"http://127.0.0.1"];
//Reddit
[platformsRegister setupRedditByAppKey:@"ObzXn50T7Cg0Xw" redirectUri:@"https://www.mob.com/reddit_callback"];
//ESurfing(天翼)
[platformsRegister setupESurfingByAppKey:@"8148612606" appSecret:@"mCltrhUqwshFa86egDTs0491ibaAulKA" appName:@"shareSDK"];
}];
return YES;
} 第二步:添加实现代码 打开需要集成分享功能的视图源码,把如下代码复制并粘贴到你要分享的位置,例如到响应分享按钮的方法中。并且修改相应的参数即可。1.需要在分享的试图中导入的头文件 #import <ShareSDK/ShareSDK.h>
#import <ShareSDKUI/ShareSDK+SSUI.h> 2.调用构造分享参数接口和分享的接口 由于苹果审核政策需求,对于那些需要客户端分享的平台,例如微信,QQ,QQ空间等,我们的分享菜单的方法里已经处理,没有安装客户端是不会在分享菜单上显示的,只有安装了才会显示。 // 使用ShareSDK提供的分享菜单
//1、创建分享参数
NSArray* imageArray = @[[UIImage imageNamed:@"shareImg.png"]];
//(注意:图片可以是UIImage对象,名称必须要传正确,如果要分享网络图片,可以这样传iamge参数 images:@[@"http://mob.com/Assets/images/logo.png?v=20150320"])
NSMutableDictionary *shareParams = [NSMutableDictionary dictionary];
[shareParams SSDKSetupShareParamsByText:@"分享内容"
images:imageArray
url:[NSURL URLWithString:@"http://mob.com"]
title:@"分享标题"
type:SSDKContentTypeAuto];
//2、分享(可以弹出我们的分享菜单和编辑界面)
//大家请注意:4.1.2版本之前(不包含) 调用此方法使用SDK提供的分享菜单
[ShareSDK showShareActionSheet:nil //要显示菜单的视图, iPad版中此参数作为弹出菜单的参照视图,只有传这个才可以弹出我们的分享菜单,可以传分享的按钮对象或者自己创建小的view 对象,iPhone可以传nil不会影响
items:nil
shareParams:shareParams
onShareStateChanged:^(SSDKResponseState state, SSDKPlatformType platformType, NSDictionary *userData, SSDKContentEntity *contentEntity, NSError *error, BOOL end) {
switch (state) {
case SSDKResponseStateSuccess:
{
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"分享成功"
message:nil
delegate:nil
cancelButtonTitle:@"确定"
otherButtonTitles:nil];
[alertView show];
break;
}
case SSDKResponseStateFail:
{
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"分享失败"
message:[NSString stringWithFormat:@"%@",error]
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles:nil, nil];
[alert show];
break;
}
default:
break;
}
}];
//大家请注意:4.1.2版本开始因为UI重构了下,所以这个弹出分享菜单的接口有点改变,如果集成的是4.1.2以及以后版本,如下调用:
[ShareSDK showShareActionSheet:nil
customItems:nil
shareParams:shareParams
sheetConfiguration:nil
onStateChanged:^(SSDKResponseState state, SSDKPlatformType platformType, NSDictionary *userData, SSDKContentEntity *contentEntity, NSError *error, BOOL end) {
switch (state) {
case SSDKResponseStateSuccess:
{
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"分享成功"
|
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论