Latest 1.0.1
Homepage https://github.com/poholo/MCDingTalk
License MIT
Platforms ios 8.0, requires ARC
Authors

钉钉(DingTalk)分享、授权SDK

用法

  1. Info.plist配置查询钉钉授权登录scheme权限。LSApplicationQueriesSchemes中添加dingtalk, dingtalk-open, dingtalk-sso。dingtalk用于查询是否安装钉钉。dingtalk-open用于查询是否支持开放平台接口调用(不需要查询开放平台接口可不填)。dingtalk-sso用于查询是否支持授权登录。注:iOS系统限制LSApplicationQueriesSchemes最多只能有50个,超出的话会有一部分不生效。
    如图:
    undefined
  2. Info.plist的URL Types中增加appId,用于钉钉App返回回调。
    undefined

  3. app启动时注册appId。示例代码:
// 在app启动时注册appId
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    // 注册AppId;
    [DTOpenAPI registerApp:#该应用的appId#];
    return YES;
}
  1. 发起授权登录。示例代码:
DTAuthorizeReq *authReq = [DTAuthorizeReq new];
authReq.bundleId = #该应用的bundleId#;
  1. 处理回调。示例代码:
// 在app delegate链接处理回调中调用钉钉回调链接处理方法
- (BOOL)application:(UIApplication *)application
            openURL:(nonnull NSURL *)url
  sourceApplication:(nullable NSString *)sourceApplication
         annotation:(nonnull id)annotation
{
    if ([DTOpenAPI handleOpenURL:url delegate:self]) {
        return YES;
    }

    return NO;
}
// delegate实现回调处理方法 onResp:
- (void)onResp:(DTBaseResp *)resp
{
  //授权登录回调参数为DTAuthorizeResp,accessCode为授权码
    if ([resp isKindOfClass:[DTAuthorizeResp class]]) {
        DTAuthorizeResp *authResp = (DTAuthorizeResp *)resp;
        NSString *accessCode = authResp.accessCode;
        // 将授权码交给服务端做SSO
    }
}

updates


1.0.1 更新依赖方式(pod版),支持最新的sdk

Author

littleplayer [email protected]

License

MCDingTalk is available under the MIT license. See the LICENSE file for more info.

Latest podspec

{
    "name": "MCDingTalk",
    "version": "1.0.1",
    "summary": "DTShareKitu5b98u65b9u5e93u6620u5c04",
    "description": "MCDingTalku662fu5bf9DTShareKitu7684u6620u5c04uff0cu4f7fu7528podu4f9du8d56u7ba1u7406uff0cu4fbfu4e8eu5f00u53d1u8005u5febu901fu96c6u6210DTShareKitu7684u767bu5f55u3001u5206u4eabu7b49u529fu80fdu3002",
    "license": "MIT",
    "authors": {
        "littleplayer": "[email protected]"
    },
    "homepage": "https://github.com/poholo/MCDingTalk",
    "source": {
        "git": "https://github.com/poholo/MCDingTalk.git",
        "tag": "1.0.1"
    },
    "platforms": {
        "ios": "8.0"
    },
    "requires_arc": true,
    "vendored_frameworks": "Example/DTShareKit.framework"
}

Pin It on Pinterest

Share This