TencentCaptchaFunction
示例
要运行示例项目,首先克隆仓库,然后从示例目录首先运行pod install
。
要求
安装
TencentCaptchaFunction可以通过CocoaPods获取。要安装它,只需将以下行添加到您的Podfile中
pod 'TencentCaptchaFunction', '~> 1.0.1'
用法
导入框架
#import <TencentCaptchaFunction/TencentCaptchaViewController.h>
然后,初始化TencentCaptchaFunction实例并设置appId属性。您可以在腾讯开放开发者平台注册账户并请求appId。
Objective C
TencentCaptchaViewController *controller = [[TencentCaptchaViewController alloc] initWithAppId:@"your appid" enableDarkMode:YES];
controller.modalPresentationStyle = UIModalPresentationOverFullScreen;
controller.onLoaded = ^(NSDictionary * _Nonnull data) {
NSDictionary<NSString *, id> *eventData = @{
@"method": @"onLoaded",
@"data": data,
};
NSLog(@"%@", eventData);
};
controller.onSuccess = ^(NSDictionary * _Nonnull data) {
NSDictionary<NSString *, id> *eventData = @{
@"method": @"onSuccess",
@"data": data,
};
NSLog(@"%@", eventData);
};
controller.onFail = ^(NSDictionary * _Nonnull data) {
NSDictionary<NSString *, id> *eventData = @{
@"method": @"onFail",
@"data": data,
};
NSLog(@"%@", eventData);
};
Swift
let controller = TencentCaptchaViewController(appId: "your appid", enableDarkMode: true)
controller.modalPresentationStyle = UIModalPresentationStyle.overFullScreen
controller.onLoaded = { data in
print(data)
}
controller.onSuccess = { data in
print(data)
}
controller.onFail = { [weak self] data in
print(data)
}
并且你将看到类似的图片
作者
ninjaKID, [email protected]
参考
https://cloud.tencent.com/document/product/1110/36841
https://github.com/BaconTimes/TencentCaptchaSDK
https://github.com/leanflutter/flutter_tencent_captcha
许可证
TencentCaptchaFunction 在 MIT 许可下可用。有关更多信息,请参阅 LICENSE 文件。