官方下载ShareSDK iOS:http://sharesdk.cn/

ShareSDK社会化分享

包含“社会化分享组件”“社会化登录组件”“第三方评论和赞”三大模块,并有详尽的数据统计后台,助力移动开发者接入第三方平台实现快速成长。

ShareSDK产品介绍

ShareSDK是为iOS、Android的App提供社会化功能的一个组件,开发者仅需10分钟即可集成到自己的 App中,它不仅支持国内外40多家的主流社交平台,帮助开发者轻松实现社会化分享、登录、关注、获得用户资料、获取好友列表等主流的社会化功能,还有强 大的社会化统计分析管理后台,可以实时了解用户、信息流、回流率、传播效率等数据,有效地指导移动App的日常运营与推广,同时为App引入更多的社会化 流量。

为什么使用ShareSDK?

快速获取更多用户

更流畅的体验 ShareSDK统一了所有的社交平台的接口,并拥有完善的开发文档;

更高效的推广

ShareSDK七大优势

永久免费

自定义UI

一键分享

支持平台最全

SDK体积最小

数据统计最全

深度支持游戏:

  • 好友关系运用——邀请好友、求助、发起挑战、索取道具、好友排行、分享炫耀。

ShareSDK功能介绍

1 一键分享

支持分享文字、图片、图文、音乐、视频、链接,可一键分享至微信、微博、Facebook、Twitter等多个平台;支持@好友和话题功能。轻松实现你分享出去的链接中,仅让用户看到您的官网地址,而并非ShareSDK。

2 第三方登录

利用第三方社交网络账号QQ、微博等方式登录APP更方便快捷,用户授权后,开发者也可方便获取用户基本信息,如头像、昵称和签名。可轻松实现获取微博好友关系、微博内容、用户资料、LBS信息。

3 评论和赞

用户可通过第三方账号或者自有账号登录,对你设置的主题进行评论或赞,同时您也能在后台审核评论内容,轻松建立社区氛围。

4 给你一个看得见用户分享行为的水晶球——社会化数据统计

ShareSDK统计后台实时查看App各项社会化数据,帮助开发者了解社会化数据的各项指标,便于开发者从社交属性、用户分布、平台选择、营销效果等多个维度评估App,助力产品优化改进。

Share SDK的集成:

前提:在友盟官网注册应用得到appkey (获取AppKey)

如何在我们的官网注册应用得到appkey,请点击链接看里面的操作步骤

(1)官方下载ShareSDK iOS,地址:http://sharesdk.cn/

(2)根据实际情况,引入相关的库,参考官方集成文档。

(3)在项目的AppDelegate中一般情况下有三个操作,第一是注册ShareSDK,第二是注册各个平台的账号,第三是关于微信等应用的回调处理。

在appdelegate.m中:

// 分享
    [DMShare registerApp];
    [DMShare addSharePlat];

- (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url
{
    return [ShareSDK handleOpenURL:url wxDelegate:self];
}

定义一个类继承nsobject:

#import <Foundation/Foundation.h>
#import <ShareSDK/ShareSDK.h>
#import <TencentOpenAPI/QQApiInterface.h>
#import <TencentOpenAPI/TencentOAuth.h>
#import "WXApi.h"
#import "WeiboSDK.h"
#import "DMShareModel.h"

@interface DMShare : NSObject

+ (void)registerApp;
+ (void)addSharePlat;
+ (void)showShare:(DMShareModel *)shareModel addTarget:(id)target;

#import "DMShare.h"

@interface DMShare () <ISSShareViewDelegate>

@end

@implementation DMShare

+ (void)registerApp
{
    [ShareSDK registerApp:@"a63d9d1a2908"];
}

+ (void)addSharePlat
{
    //添加新浪微博应用
//    [ShareSDK connectSinaWeiboWithAppKey:@"199632105"
//                               appSecret:@"526a34cbb19d70f685a1dc25d2e09c76"
//                             redirectUri:@"https://api.weibo.com/oauth2/default.html"];
    
    //添加QQ空间应用
//    [ShareSDK connectQZoneWithAppKey:@"1104479433"
//                           appSecret:@"safjx8rydezdBCZC"
//                   qqApiInterfaceCls:[QQApiInterface class]
//                     tencentOAuthCls:[TencentOAuth class]];
    
    //添加QQ应用
//    [ShareSDK connectQQWithQZoneAppKey:@"1104479433"
//                     qqApiInterfaceCls:[QQApiInterface class]
//                       tencentOAuthCls:[TencentOAuth class]];
    
    //添加微信应用
    [ShareSDK connectWeChatWithAppId:@"wx90b632077a12a1be"
                           appSecret:@"2ba12ff131ca59db383c49cf2ec59e1e"
                           wechatCls:[WXApi class]];
}

+ (void)showShare:(DMShareModel *)shareModel addTarget:(id)target
{
    NSArray *shareList = [ShareSDK getShareListWithType:ShareTypeWeixiSession, ShareTypeWeixiTimeline,nil];
    id<ISSAuthOptions> authOptions = [ShareSDK authOptionsWithAutoAuth:YES
                                                         allowCallback:NO
                                                         authViewStyle:SSAuthViewStyleFullScreenPopup
                                                          viewDelegate:target
                                               authManagerViewDelegate:target];
    //隐藏logo
    [authOptions setPowerByHidden:YES];
    
//    id<ISSShareOptions> shareOptions = [ShareSDK defaultShareOptionsWithTitle:@"内容分享"
//                                                              oneKeyShareList:[NSArray defaultOneKeyShareList]
//                                                               qqButtonHidden:YES
//                                                        wxSessionButtonHidden:YES
//                                                       wxTimelineButtonHidden:YES
//                                                         showKeyboardOnAppear:NO
//                                                            shareViewDelegate:target
//                                                          friendsViewDelegate:target
//                                                        picViewerViewDelegate:nil];
    id<ISSShareOptions> shareOptions = [ShareSDK defaultShareOptionsWithTitle:@"内容分享"
                                                              oneKeyShareList:shareList
                                                               qqButtonHidden:YES
                                                        wxSessionButtonHidden:YES
                                                       wxTimelineButtonHidden:YES
                                                         showKeyboardOnAppear:NO
                                                            shareViewDelegate:target
                                                          friendsViewDelegate:target
                                                        picViewerViewDelegate:nil];
    
    //在授权页面中添加关注官方微博
//    [authOptions setFollowAccounts:[NSDictionary dictionaryWithObjectsAndKeys:
//                                    [ShareSDK userFieldWithType:SSUserFieldTypeName value:@"ShareSDK"],
//                                    SHARE_TYPE_NUMBER(ShareTypeSinaWeibo),
//                                    [ShareSDK userFieldWithType:SSUserFieldTypeName value:@"ShareSDK"],
//                                    SHARE_TYPE_NUMBER(ShareTypeTencentWeibo),
//                                    nil]];
    
    //构造分享内容
    id<ISSContent> publishContent = [ShareSDK content:shareModel.content
                                       defaultContent:shareModel.defaultContent
                                                image:[ShareSDK imageWithPath:shareModel.imageUrl]
                                                title:shareModel.title
                                                  url:shareModel.url
                                          description:shareModel.content
                                            mediaType:SSPublishContentMediaTypeNews];
    //定制QQ空间信息
//    [publishContent addQQSpaceUnitWithTitle:shareModel.title
//                                        url:shareModel.url
//                                       site:nil
//                                    fromUrl:nil
//                                    comment:[SSInheritValue inherit]
//                                    summary:[SSInheritValue inherit]
//                                      image:[SSInheritValue inherit]
//                                       type:[SSInheritValue inherit]
//                                    playUrl:nil
//                                       nswb:nil];
    
    //定制QQ分享信息
//    [publishContent addQQUnitWithType: INHERIT_VALUE
//                              content: shareModel.content
//                                title: shareModel.title
//                                  url: shareModel.url
//                                image:[ShareSDK imageWithPath:shareModel.imageUrl]];
    
    //定制微信好友信息
    [publishContent addWeixinSessionUnitWithType: INHERIT_VALUE
                                         content: INHERIT_VALUE
                                           title: shareModel.title
                                             url: shareModel.url
                                      thumbImage: [ShareSDK imageWithPath:shareModel.imageUrl]
                                           image: INHERIT_VALUE
                                    musicFileUrl: nil
                                         extInfo: nil
                                        fileData: nil
                                    emoticonData: nil];
    
    //定制微信朋友圈信息
    [publishContent addWeixinTimelineUnitWithType: [NSNumber numberWithInteger:SSPublishContentMediaTypeNews]
                                          content: INHERIT_VALUE
                                            title: shareModel.title
                                              url: shareModel.url
                                       thumbImage: [ShareSDK imageWithPath:shareModel.imageUrl]
                                            image: INHERIT_VALUE
                                     musicFileUrl: nil
                                          extInfo: nil
                                         fileData: nil
                                     emoticonData: nil];

//定制微信收藏信息
//    [publishContent addWeixinFavUnitWithType: INHERIT_VALUE
//                                     content: INHERIT_VALUE
//                                       title: shareModel.title
//                                         url: shareModel.url
//                                  thumbImage: [ShareSDK imageWithPath:shareModel.imageUrl]
//                                       image: INHERIT_VALUE
//                                musicFileUrl: nil
//                                     extInfo: nil
//                                    fileData: nil
//                                emoticonData: nil];
    
    
    [ShareSDK showShareActionSheet: nil
                         shareList: shareList
                           content: publishContent
                     statusBarTips: YES
                       authOptions: authOptions
                      shareOptions: shareOptions
                            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]);
                                }
                            }];
    
    [ShareSDK cancelAuthWithType:ShareTypeSinaWeibo];
}

#####分享按钮的触摸事件

#pragma mark - 分享请求
- (void)shareRequestWithParameters:(NSDictionary *)parameters WithButton:(UIButton*)sender
{
    [DMHttpRequest get:DMShareUrl parameters:parameters success:^(id responseObj) {
        DMRequestCode code = [DMTools responseCode:responseObj];
        sender.userInteractionEnabled = YES;
        NSLog(@"%@",responseObj);
        switch (code) {
            case DMRequestSuccess: {
                [self.hud hide:YES];
                //                [DMTools loadSuccessHUD:self.hud text:[DMTools responseMessage:responseObj] delay:DMHUDDelayTimeInterval];
                dispatch_async(dispatch_get_main_queue(), ^{
                    if (responseObj[@"data"]==nil||[responseObj[@"data"]isKindOfClass:[NSNull class]]) {
                        return ;
                    }
                    // 请求完成后加载数据
                    DMShareModel *model = [[DMShareModel alloc]init];
                    model.title = responseObj[@"data"][@"title"];
                    model.content = responseObj[@"data"][@"content"];
                    if ([responseObj[@"data"][@"pic_url"] hasPrefix:@"http"]) {
                        model.imageUrl =  [ShareSDK imageWithUrl:responseObj[@"data"][@"pic_url"]];
                    }else
                    {
                        model.imageUrl = [ShareSDK imageWithPath:[[NSBundle mainBundle] pathForResource:@"icon_钱富宝logo_登录页@3x" ofType:@"png"]] ;
                    }
                    model.url = responseObj[@"data"][@"url"];
                    self.shareModel = model;
                    [[DMShareView shareInstance]showShare:self.shareModel addTarget:self];
                    //                    [DMShare showShare:self.shareModel addTarget:self];
                    
                });
                break;
            }
            default:
                //                [DMTools loadFailedHUD:self.hud text:[DMTools responseMessage:responseObj] delay:DMHUDDelayTimeInterval];
            {
                [self.hud hide:YES];
                [[DMShareView shareInstance]showShare:nil addTarget:self];
                
                break;
            }
        }
        
    } failure:^(NSError *error) {
        [self.hud hide:YES];
        //        [DMTools loadFailedHUD:self.hud text:DMRequestFailureNote delay:DMHUDDelayTimeInterval];
        [[DMShareView shareInstance]showShare:nil addTarget:self];
        sender.userInteractionEnabled = YES;
    }];
}

iOS-ShareSDK的使用(转)的更多相关文章

  1. iOS ShareSDK 使用

    流量精灵软件中,也在大部分地方使用到了shareSDK 这个三方开源库.具体的有两种需求 a.弹出所有分享模块 b.只弹出指定的平台:如微信朋友圈和QQ . 配置方法,三方库中也很详细,这里我只有写出 ...

  2. iOS ShareSDK 三方分享/登录使用

    原文 http://www.cnblogs.com/CoderAlex/p/4860352.html 一: 快速集成 1.前言 作为现在App里必不可少的用户分享需要,社交化分享显然是我们开发app里 ...

  3. iOS - ShareSDK第三方分享(图文和视频)和登录

    由于近期工作需要自己抽时间搞了一下第三方分享,这里使用的是shareSDK的第三方,在使用的过程中有一些心得和体会,特在此和大家分享一下~ 1.在经过将近一周时间的开发,终于搞定ios分享了. 2.由 ...

  4. iOS:ShareSDk的分享

    使用分享类的SDK其实有很多,例如友盟.ShareSDK等等,参照他们的文档集成起来并不是很难,可能出的一些问题也就是配置文件的问题,这里我个人使用了ShareSDK分享,具体操作可出现的问题如下: ...

  5. iOS:shareSDK第三方登录

    shareSDK第三方登录跟分享差不多,比较简单,前面已有介绍.这里简单写一下第三方登录吧. 1.首先:我用到了QQ.微信.新浪这三个平台的登录,需要到它们各自的开发者平台注册开发者账号,这是我的QQ ...

  6. iOS之ShareSDK实现分享、第三方登录等功能

    (1)官方下载ShareSDK iOS 2.8.8,地址:http://sharesdk.cn/ (2)根据实际情况,引入相关的库,参考官方文档. (3)在项目的AppDelegate中一般情况下有三 ...

  7. iOS开发- 三步快速集成社交化分享工具ShareSDK

    1.前言 作为现在App里必不可少的用户分享需要,社交化分享显然是我们开发app里较为常用的. 最近因为公司App有社交化分享的需要,就特此研究了会,拿出来与大家分享. 想要集成社交会分享,我们可以使 ...

  8. iOS开发---集成ShareSDK实现第三方登录、分享、关注等功能。

    (1)官方下载ShareSDK IOS 2.9.6,地址:http://sharesdk.mob.com/Download (2)根据实际情况,引入相关的库,参考官方文档. (3)在项目的AppDel ...

  9. IOS项目集成ShareSDK实现第三方登录、分享、关注等功能。

    (1)官方下载ShareSDK iOS 2.8.8,地址:http://sharesdk.cn/ (2)根据实际情况,引入相关的库,参考官方文档. (3)在项目的AppDelegate中一般情况下有三 ...

  10. IOS开发之—— ShareSDK的使用

    官方下载ShareSDK iOS:http://sharesdk.cn/ ShareSDK社会化分享 包含“社会化分享组件”“社会化登录组件”“第三方评论和赞”三大模块,并有详尽的数据统计后台,助力移 ...

随机推荐

  1. HDU 6735 结论网络流 机器人不重叠路径

    我们可以得到一个结论:没有两个机器人走过的路会重叠 所以题目就转变为了能不能让机器人的路径不重叠且每个机器人能到达终点 直接一个点朝他四连通方向的四个点连容量为1的边即可 #include<bi ...

  2. 开发中少不了的Fun -- 前端本地存储

    存储sessionStorage function setSessionStore (name, content) { if (!name) return if (typeof content !== ...

  3. 通过Chrome控制台详细查看ajax请求

    1.F12打开浏览器开发者工具 2.如图所示

  4. [2019HDU多校第三场][HDU 6603][A. Azshara's deep sea]

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=6603 题目大意:给出一个凸包,凸包内有若干个圆,要求画尽可能多的对角线使得他们两两不在凸包内相交且不与 ...

  5. 3、Spring Boot 2.x 核心技术

    1.3 Spring Boot 核心技术 1.3.1 起步依赖 为项目的依赖管理提供帮助.起步依赖其实就是特殊的Maven,利用了传递依赖解析,把常用库聚合在一起,组成几个为特定功能而定制的依赖. 1 ...

  6. [Luogu P4145] 上帝造题的七分钟2 / 花神游历各国

    题目链接 题目简要:我们需要一个能支持区间内每一个数开方以及区间求和的数据结构. 解题思路:说道区间修改区间查询,第一个想到的当然就是分块线段树.数据范围要用long long.本来我是看到区间这两个 ...

  7. vue 中 v-model

    一.v-model: 先上段简单的 vue 代码: // 定义 v-model 示例组件 Vue.component('bindData', { template:` <div> < ...

  8. 数据结构实验之栈与队列四:括号匹配(SDUT 2134)

    #include <bits/stdc++.h> using namespace std; typedef long long ll; char s[100]; char a[100]; ...

  9. hive的两种使用方式

    hive的两种使用方式 1,hive shell的方式 启动命令: bin/hive 2.beeline客户端方式 首先在一个机器上启动hive thrift服务 bin/hiveserver2 在其 ...

  10. ubuntu 14.04 安装ntp

    安装 sudo apt-get install ntp 修改ntp.conf配置文件 sudo vi /etc/ntp.conf 修改为如下内容 # Enable this if you want s ...