quankevin / QShare

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

#QShare 这个项目是根据 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保证各个第三方可以创建在容器中。

About

License:MIT License


Languages

Language:Objective-C 99.1%Language:Ruby 0.9%