官方下载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. Java多维数组定义以及常见异常

    import java.lang.*; import java.util.*; public class Demo1 { public static void main(String args[]){ ...

  2. 使用Python进行3DES加密-pyDes

    pyDes.py源码 ############################################################################# # Documenta ...

  3. 10—mybatis 通用mapper插件 pagehelper 分页

    spring boot真的太好用了,大家以后多多使用,今天来说说pagehelper 来做mybatis分页,我用的是spring boot 做的开发,后面会把源码发出来. pagehelper(ht ...

  4. Checklist的补充规则

    常见问题: 1.什么时候该补充Checklist? 2.Checklist应该写哪些用例? 3.自己写的模块是否自己执行? 4.什么时候执行Checklist? 5.执行完Checklist大概需要花 ...

  5. maven 安装第三方jar到本地 出现 The goal you specified requires a project to execute but there is no POM in this directory 错误

    原因是因为操作系统的差异导致,把所有参数加上引号即可. 如下所示: mvn install:install-file "-Dfile=cobra.jar" "-Dgrou ...

  6. 我是如何理解Android的Handler模型_1

    Handler Message类似于旧时的电话系统,对应关系如下: 电话局->Handler 电话机->Message 接线员->handlerMessage 接线员的工作-> ...

  7. Java8-Annotations

    import java.lang.annotation.ElementType; import java.lang.annotation.Repeatable; import java.lang.an ...

  8. Enum 类型

    枚举类型(Enumerated Type) 什么是枚举? 枚举是一个被命名的整型常数的集合.在多种编程语言中都有使用(C/C++/c#/java等). 示例 public enum Size { S, ...

  9. keydown([[data],fn]) 当键盘或按钮被按下时,发生 keydown 事件。

    keydown([[data],fn]) 概述 当键盘或按钮被按下时,发生 keydown 事件. 注释:如果在文档元素上进行设置,则无论元素是否获得焦点,该事件都会发生.直线电机滑台 参数 fnFu ...

  10. PHP mysqli_error() 函数

    返回最近调用函数的最后一个错误描述: <?php  // 假定数据库用户名:root,密码:123456,数据库:RUNOOB  $con=mysqli_connect("localh ...