QShare 1.0.1

QShare 1.0.1

测试已测试
Lang语言 Obj-CObjective C
许可证 MIT
发布最新版本2016 年 8 月

QShare 维护。



QShare 1.0.1

此项目是基于 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保证各个第三方可以创建在容器中。