1 Star 0 Fork 0

awanglilong / GSSocialSDK

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
WTFPL

SocialSDK

Version Platform Carthage Compatible build

简介: 实现 Sina WeChat QQ 登录和分享功能

所用第三方SDK版本

SocialSDK QQ(SDK) Sina(SDK) WeChat(SDK)
0.0.3 3.1.3 3.1.4 1.7.5
0.0.4 3.2.1 3.1.4 1.7.7
0.0.5 3.3.3 3.1.4 1.8.2

1. SDK功能

平台 分享 登录 支付
Sina ×
QQ ×
Wechat ×

2.分享渠道支持

渠道 纯文本 单图 普通链接 音频链接 视频链接
Sina
QQ
Qzone
WechatSession
WechatTimeLine

Renderings

纯文本、单图、URL、音频链接、视频链接分享

         

微博登录

 

平台集成

1. SocialSDK集成

2. SocialSDK各平台配置

3. 调用SocialSDK


Installation

CocoaPods

编写podfile分为是否使用了use_frameworks!两种情况

1.如果没使用use_frameworks!

pod 'SocialSDK_UF', :git => "https://gitee.com/awanglilong/SocialSDK.git" 

2.使用了use_frameworks!

pod 'SocialSDK', :git => "https://gitee.com/awanglilong/SocialSDK.git" 

手动集成介绍

直接拖动Classes文件到自己的项目中,添加Resources中的资源文件(推荐使用CocoaPods)。

SocialSDK各平台配置

Sina平台配置

WeChat平台配置

QQ平台配置

  • 1、 添加URL Schemes
  • 格式"tencent"+QQ的appID + "QQ"+QQ的appID转换成十六进制(不足8位前面补0) 在线转换十六进制
  • 例如: appID:100424468 --> tencent100424468 QQ05fc5b14
  • 2、适配iOS9+系统

iOS9+适配

1. HTTPS传输 在info.plist中加入安全域名白名单(右键info.plist用source code打开)

<key>NSAppTransportSecurity</key>
<dict>
    <key>NSExceptionDomains</key>
    <dict>
        <key>sina.cn</key>
        <dict>
            <key>NSIncludesSubdomains</key>
            <true/>
            <key>NSThirdPartyExceptionRequiresForwardSecrecy</key>
            <false/>
            <key>NSExceptionMinimumTLSVersion</key>
            <string>TLSv1.0</string>
        </dict>
        <key>weibo.cn</key>
        <dict>
            <key>NSIncludesSubdomains</key>
            <true/>
            <key>NSThirdPartyExceptionRequiresForwardSecrecy</key>
            <false/>
            <key>NSExceptionMinimumTLSVersion</key>
            <string>TLSv1.0</string>
        </dict>
        <key>weibo.com</key>
        <dict>
            <key>NSIncludesSubdomains</key>
            <true/>
            <key>NSThirdPartyExceptionAllowsInsecureHTTPLoads</key>
            <true/>
            <key>NSExceptionMinimumTLSVersion</key>
            <string>TLSv1.0</string>
            <key>NSThirdPartyExceptionRequiresForwardSecrecy</key>
            <false/>
        </dict>
        <key>sinaimg.cn</key>
        <dict>
            <key>NSIncludesSubdomains</key>
            <true/>
            <key>NSThirdPartyExceptionAllowsInsecureHTTPLoads</key>
            <true/>
   			  <key>NSExceptionMinimumTLSVersion</key>
            <string>TLSv1.0</string>
            <key>NSThirdPartyExceptionRequiresForwardSecrecy</key>
            <false/>
        </dict>
        <key>sinajs.cn</key>
        <dict>
            <key>NSIncludesSubdomains</key>
            <true/>
            <key>NSThirdPartyExceptionAllowsInsecureHTTPLoads</key>
            <true/>
            <key>NSExceptionMinimumTLSVersion</key>
            <string>TLSv1.0</string>
            <key>NSThirdPartyExceptionRequiresForwardSecrecy</key>
            <false/>
        </dict>
        <key>sina.com.cn</key>
        <dict>
            <key>NSIncludesSubdomains</key>
            <true/>
            <key>NSThirdPartyExceptionAllowsInsecureHTTPLoads</key>
            <true/>
            <key>NSExceptionMinimumTLSVersion</key>
            <string>TLSv1.0</string>
            <key>NSThirdPartyExceptionRequiresForwardSecrecy</key>
            <false/>
        </dict>
    </dict>
</dict>

2.配置ApplicationQueriesSchemes(应用间跳转)

<key>LSApplicationQueriesSchemes</key>
<array>
    <!-- 微信 URL Scheme 白名单-->
    <string>wechat</string>
    <string>weixin</string>

    <!-- 新浪微博 URL Scheme 白名单-->
    <string>sinaweibohd</string>
    <string>sinaweibo</string>
    <string>weibosdk</string>
    <string>weibosdk2.5</string>

    <!-- QQQzone URL Scheme 白名单-->
    <string>mqqapi</string>
    <string>mqq</string>
    <string>mqqOpensdkSSoLogin</string>
    <string>mqqconnect</string>
    <string>mqqopensdkdataline</string>
    <string>mqqopensdkgrouptribeshare</string>
    <string>mqqopensdkfriend</string>
    <string>mqqopensdkapi</string>
    <string>mqqopensdkapiV2</string>
    <string>mqqopensdkapiV3</string>
    <string>mqqopensdkapiV4</string>
    <string>mqzoneopensdk</string>
    <string>wtloginmqq</string>
    <string>wtloginmqq2</string>
    <string>mqqwpa</string>
    <string>mqzone</string>
    <string>mqzonev2</string>
    <string>mqzoneshare</string>
    <string>wtloginqzone</string>
    <string>mqzonewx</string>
    <string>mqzoneopensdkapiV2</string>
    <string>mqzoneopensdkapi19</string>
    <string>mqzoneopensdkapi</string>
    <string>mqqbrowser</string>
    <string>mttbrowser</string>
</array>

初始化配置

AppDelegate.m 中做如下配置

   #import "GSPlatformParamConfigManager.h"
   #import "GSSocialManager.h"
   
 - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 
{
    [[GSPlatformParamConfigManager share] addSinaPlatformConfigAppKey:@"" redirectURI:@""];
    [[GSPlatformParamConfigManager share] addQQPlatformConfigAppID:@""];
    [[GSPlatformParamConfigManager share] addWeChatPlatformConfigAppID:@"" secret:@""];
    return YES;
}

- (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options
{
    BOOL res = [[GSSocialManager share] handleOpenURL:url];
    if (!res) {
        //做其他SDK回调处理
    }
    return res;
}

- (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url
{
    BOOL res = [[GSSocialManager share] handleOpenURL:url];
    if (!res) {
        //做其他SDK回调处理
    }
    return res;
}

第三方平台登录

#import "GSSelectView.h"
#import "GSShareChannelType.h"
#import "GSLoginManager.h"
    [GSSelectView showShareViewWithChannels:@[
                                            @(GSShareChannelTypeSina),
                                            @(GSShareChannelTypeQQ),
                                            @(GSShareChannelTypeQzone),
                                            @(GSShareChannelTypeWechatSession)
                                            ] completionBlock:^(BOOL isCancel, GSLogoReourcesType reourcesType) {
                                                if (isCancel) {
                                                    
                                                } else {
                                                    id<GSLoginProtocol> login = [[GSLoginManager share] getShareProtocolWithChannelType:[GSLoginManager getShareChannelTypeWithLogoReourcesType:reourcesType]];
                                                    [login setLoginCompletionBlock:^(id<GSLoginResultProtocol> result) {
                                                        
                                                    }];
                                                    [login doLogin];
                                                }
  }];

第三方平台分享

#import "GSSelectView.h"
#import "GSShareChannelType.h"
#import "GSShareManager.h"
    [GSSelectView showShareViewWithChannels:@[
                                              @(GSShareChannelTypeSina),
                                              @(GSShareChannelTypeQQ),
                                              @(GSShareChannelTypeQzone),
                                              @(GSShareChannelTypeWechatSession)
                                              ] completionBlock:^(BOOL isCancel, GSLogoReourcesType reourcesType) {
                                                  if (isCancel) {
                                                      
                                                  } else {
                                                      id<GSShareProtocol> share = [[GSShareManager share] getShareProtocolWithChannelType:[GSShareManager getShareChannelTypeWithLogoReourcesType:reourcesType]];
                                                      [share shareSimpleText:@"good day"];
                                                      [share setShareCompletionBlock:^(id<GSShareResultProtocol> result) {
                                                          
                                                      }];
                                                  }
    }];

License

SocialSDK is under WTFPL. You can do what the fuck you want with SocialSDK. See LICENSE file for more info.

DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE Version 2, December 2004 Copyright (C) 2004 Li Junjie <itlijunjie@gmail.com> Everyone is permitted to copy and distribute verbatim or modified copies of this license document, and changing it is allowed as long as the name is changed. DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. You just DO WHAT THE FUCK YOU WANT TO.

简介

三方SDK的使用改为了Pod管理 展开 收起
Objective-C
WTFPL
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
Objective-C
1
https://gitee.com/awanglilong/GSSocialSDK.git
git@gitee.com:awanglilong/GSSocialSDK.git
awanglilong
GSSocialSDK
GSSocialSDK
master

搜索帮助

14c37bed 8189591 565d56ea 8189591