DOUSNSSharing 2.3.6

DOUSNSSharing 2.3.6

测试已测试
语言 Obj-CObjective C
许可 自定义
发布最新发布2014年12月

Tony Li维护。



  • 豆瓣iOS开发者

豆瓣第三方认证和分享库 - DoubanSNSSharing

功能概要说明

这是一个提供第三方认证和分享的iOS公共库。

v2.x 版本目前已有功能:

供应商 OAuth2认证 SSO OAuth2认证 分享
豆瓣 支持 不支持 支持
新浪微博 支持 不支持 支持
腾讯微博 支持 不支持 支持
人人 支持 不支持 支持

版本说明

当前的代码为v2.x版本

开发计划

  • 支持通过SSO认证方式获取Access Token
  • 加入更多的OAuth认证和分享实现,比如QQ Zone,
  • [待定]支持iOS内置的分享渠道。

使用方式

第一步 作为submodule,加入项目的git创库中
$  git submodule add https://github.com/douban/DOUSNSSharing.git ${path}
$  cd ${path}
$  git checkout ${version}
$  git submodule update --init --recursive
第二步 加入项目编译依赖和静态链接库
* 在Build Phases -> Target Dependencies 中加入target:DOUSNSSharing
* 在Build Phases -> Link Binary With Libraries 中加入链接库:libDOUSNSSharing.a
第三步 使用认证的功能

详细信息可以查看Demo中的OAuthSampleBaseViewController

  self.authorizationManager = [[DOUOAuth2AuthorizationManager alloc] initWithClientid:[self venderAPIKey]
                                                                           secret:[self venderAPISecrect]
                                                                       venderType:[self venderType]];

  [self.authorizationManager setBlocksForDidSucceedBlock:^(DOUOAuth2Credential *credential) {

  } didFailBlock:^(NSError *error) {

  } didCancelBlock:^(DOUOAuth2Credential *credential) {

  }];
  UIView *oauthView = [self.authorizationManager requestWithRedirectUri:[self oauthRedirectURL]
                                                              scope:nil];
  [self.view addSubview:oauthView];
第四步 使用分享功能

详细信息可以查看Demo中的AuthorizationSamplesViewController

self.requestManager = [[DOUVenderAPIRequestManager alloc]   initWithBlocksForDidFinishBlock:^(NSInteger toalCount, NSInteger succeedCount, NSArray *credentialsForFailures) {
  [self showAlertViewWithText:@"Finished!"];
} didSendOneBlock:^(DOUVenderAPIResponse *resp) {
  [self showAlertViewWithText:@"succeed to send one"];
} didFailOneBlock:^(NSError *error, DOUOAuth2VenderType venderType) {
  [self showAlertViewWithText:[NSString stringWithFormat:@"error %@, vender type : %d", error, venderType]];
}];

[self.requestManager sendStatus:[NSString stringWithFormat:@"%@ Test$$$", [NSDate date]]
                withCredentials:enabledArr
                   extraOptions:renrenOptions];

变更日志

2.3.4
  • 针对iPad显示的修复
V2.3.3
  • 支持豆瓣
V2.3.2
  • 修复Xcode 5中的警告
  • 更新示例:移除API密钥
V2.3.1 Bug Fix
  • 增加成功次数
  • 更新人人错误码
V2.3更新日志
  • Bug fix : 人人授权增加了publish_feed
V2.2更新日志
  • 在OAuth认证后,增加了获取User Info
  • Bug fix : 处理了一些json解析的错误
V2.1更新日志
  • 增加了错误码:区分网络错误,OAuth错误,http服务错误等
  • 更新了示例