Latest 1.0.1
Homepage https://github.com/quankevin/QShare
License MIT
Platforms ios 7.0, requires ARC
Frameworks SystemConfiguration, UIKit, CoreTelephony
Authors

这个项目是根据 https://github.com/lingochamp/Diplomat 这个开源项目改造的,感谢写这个整合的大神。

集成

QShare.h
QShare.m
这两个是算是管理各个第三方的容器。

设置key

在KeyConstants.h 中定义各个平台的key

#define sinaWBKey           @"xxx"
#define sinaAppKey          @"xxx"
#define sinaRedirectURI     @"xxx"

#define qqAppKey            @"222222"

#define wxAppKey            @"xxx"
#define wxAppSecret         @"xxx"

#define rongKeyDev          @"xxx"
#define rongKeyRelease      @"xxx"

#define buglyAppId          @"xxxx"

#define WnAppId             @"xxx"

#define alischeme           @"xxx"

初始化:

[[QShare sharedInstance] registerWithConfigurations: @{
kQShareTypeWeibo: @{
kQShareAppIdKey: sinaAppKey,
kQShareAppRedirectUrlKey: sinaRedirectURI
},
kQShareTypeWechat: @{
kQShareAppIdKey: wxAppKey,
kQShareAppSecretKey: wxAppSecret,
},
kQShareTypeQQ: @{
kQShareAppIdKey: qqAppKey
},
kQShareTypeAli:@{
kQShareAppSchemeKey: alischeme
}
}];

代理

@protocol QRegisterProxyProtocol //注册的代理
@protocol QAuthProxyProtocol //认证
@protocol QShareProxyProtocol //分享
@protocol QPayProxyProtocol //支付

理论上所有的第三方都要写注册代理,然后根据需要自己接入 认证或分享或支付代理

用微信作为例子:

WXProxy.h

FOUNDATION_EXTERN NSString * const kQShareTypeWechat;
FOUNDATION_EXTERN NSString * const kWechatSceneTypeKey;//声明这个第三方需要的一些参数

@interface WXProxy : NSObject <QRegisterProxyProtocol, QAuthProxyProtocol, QShareProxyProtocol,QPayProxyProtocol>//几个代理都加上,再重写各个方法,
@end

WXProxy.m


+ (void)load{
[[QShare sharedInstance] registerProxyObject:[[WXProxy alloc] init] withName:kQShareTypeWechat];
}//初始化,在load保证各个第三方可以创建在容器中。

Latest podspec

{
    "name": "QShare",
    "version": "1.0.1",
    "summary": "Gather Some Auth Share Pay.",
    "homepage": "https://github.com/quankevin/QShare",
    "license": "MIT",
    "authors": {
        "quankevin": "[email protected]"
    },
    "social_media_url": "http://weibo.com/quankevin",
    "platforms": {
        "ios": "7.0"
    },
    "source": {
        "git": "https://github.com/quankevin/QShare.git",
        "tag": "v1.0.1"
    },
    "frameworks": [
        "SystemConfiguration",
        "UIKit",
        "CoreTelephony"
    ],
    "libraries": [
        "stdc++",
        "sqlite3",
        "z"
    ],
    "requires_arc": true,
    "public_header_files": "QShare/ShareHeader.h",
    "subspecs": [
        {
            "name": "Core",
            "source_files": [
                "QShare/*.{h,m}",
                "QShare/QUtil/*.{h,m}"
            ]
        },
        {
            "name": "WeChat",
            "dependencies": {
                "QShare/Core": []
            },
            "source_files": [
                "QShare/Wechat/SDK/*.{h,m}",
                "QShare/Wechat/*.{h,m}"
            ],
            "vendored_libraries": "QShare/Wechat/SDK/*.a"
        },
        {
            "name": "Weibo",
            "dependencies": {
                "WeiboSDK": []
            }
        },
        {
            "name": "Tencent",
            "dependencies": {
                "QShare/Core": []
            },
            "source_files": "QShare/Tencent/*.{h,m}",
            "vendored_frameworks": "QShare/Tencent/SDK/TencentOpenAPI.framework"
        },
        {
            "name": "Ali",
            "dependencies": {
                "QShare/Core": []
            },
            "source_files": "QShare/Ali/*.{h,m}",
            "resources": "QShare/Ali/SDK/*.bundle",
            "vendored_frameworks": "QShare/Ali/SDK/AlipaySDK.framework"
        }
    ]
}

Pin It on Pinterest

Share This