产品动态
产品公告
VerificationConfig.languageType 配置:枚举值 | 含义 |
HY_EKYC_DEFAULT | 跟随系统设置 |
HY_EKYC_ZH_HANS | 简体中文 |
HY_EKYC_ZH_HANT | 繁体中文 |
HY_EKYC_EN | 英文(默认) |
HY_EKYC_CUSTOMIZE_LANGUAGE | 自定义语言 |
VerificationConfig *config = [[VerificationConfig alloc] init];config.languageType = HY_EKYC_ZH_HANS;
demo/ 目录下的工程文件,找到 UserLanguageBundle 目录下的 Localizable,该部分为翻译源文件。
UserLanguageBundle 构建目标(Build Target)。
ja.lproj)。

// 左侧为 SDK 使用的 Key,右侧为目标语言翻译内容"Verifi_OK"="OK";"Verifi_exit"="Exit";// ... 其余 Key 见下方 Key 参考表

UserLanguageBundle.bundle。
Info.plist 和 _CodeSignature 文件夹。UserLanguageBundle.bundle 导入宿主工程。VerificationConfig *config = [[VerificationConfig alloc] init];// 1. 启用自定义语言模式config.languageType = HY_EKYC_CUSTOMIZE_LANGUAGE;// 2. 指定 Bundle 的绝对路径config.userLanguageBundlePath = [[NSBundle mainBundle] pathForResource:@"UserLanguageBundle" ofType:@"bundle"];// 3. 指定语言文件夹名称config.userLanguageFileName = @"ja.lproj";
属性 | 类型 | 必填条件 | 说明 |
languageType | 枚举 | 必填 | 设为 HY_EKYC_CUSTOMIZE_LANGUAGE 才启用自定义 |
userLanguageBundlePath | NSString * | 使用自定义语言时必填 | UserLanguageBundle 的绝对路径 |
userLanguageFileName | NSString * | 使用自定义语言时必填 | 目标 .lproj 文件夹名,如 ja.lproj |
userLanguageBundlePath 为 nil,SDK 将从 mainBundle 的 huiyan_verification.bundle 中查找多语言资源(默认行为)。OcrCustomConfig *ocrConfig = [[OcrCustomConfig alloc] init];ocrConfig.rectNormalColor = [UIColor whiteColor]; // 识别框正常颜色ocrConfig.rectErrorColor = [UIColor redColor]; // 识别框错误颜色ocrConfig.rectPassColor = [UIColor greenColor]; // 识别框通过颜色ocrConfig.tipsNormalColor = [UIColor whiteColor]; // 提示文字正常颜色ocrConfig.tipsErrorColor = [UIColor redColor]; // 提示文字错误颜色ocrConfig.tipsPassColor = [UIColor greenColor]; // 提示文字通过颜色ocrConfig.tipsFont = [UIFont systemFontOfSize:14]; // 提示文字字体ocrConfig.rectScaleX = 0.03; // 识别框横向边距比例(0.0~0.15)ocrConfig.rectTopMarginScale = 0.28; // 识别框顶部边距比例(仅竖屏有效)ocrConfig.isShowTips = YES; // 是否显示提示文字ocrConfig.tipsShowText = nil; // 自定义提示文字(nil 时显示 SDK 默认文案)VerificationConfig *config = [[VerificationConfig alloc] init];config.ocrCustomConfig = ocrConfig;
FaceCustomConfig *faceConfig = [[FaceCustomConfig alloc] init];faceConfig.backgroundColor = [UIColor blackColor]; // 背景颜色faceConfig.tipsTextColor = [UIColor whiteColor]; // 提示文字颜色faceConfig.tipsTextErrorColor = UIColorFromRGB(0xFF3B30); // 提示文字错误态颜色faceConfig.tipsTextFont = [UIFont systemFontOfSize:16]; // 提示文字字体faceConfig.faceCircleErrorColor = UIColorFromRGB(0xFF3B30); // 圆框错误态颜色faceConfig.faceCircleCorrectColor = UIColorFromRGB(0x34C759); // 圆框正确态颜色faceConfig.countDownTextColor = [UIColor whiteColor]; // 倒计时文字颜色faceConfig.cancelButtonTextColor = [UIColor whiteColor]; // 取消按钮文字颜色VerificationConfig *config = [[VerificationConfig alloc] init];config.faceCustomConfig = faceConfig;
VerificationConfig.delegate 可监听 SDK 界面的创建与销毁事件,例如在 OCR 或活体人脸比对界面显示时插入自定义逻辑:VerificationConfig *config = [[VerificationConfig alloc] init];config.delegate = self; // 实现 VerificationDelegate 协议
// VerificationDelegate 协议方法@protocol VerificationDelegate <NSObject>@optional/// OCR 界面显示时回调,authView 为 SDK 展示的根视图- (void)ocrMainViewCreate:(UIView *)authView;/// OCR 界面被移除时回调- (void)ocrMainViewDestroy;/// 活体人脸比对界面显示时回调,authView 为 SDK 展示的根视图- (void)faceMainViewCreate:(UIView *)authView;/// 活体人脸比对界面被移除时回调- (void)faceMainViewDestroy;@end
@interface ViewController ()<VerificationDelegate>@end@implementation ViewController// OCR界面创建回调- (void)ocrMainViewCreate:(UIView *)authView {[self addCustomLabel:authView];}// OCR界面被回收的回调- (void)ocrMainViewDestroy {NSLog(@"ekyc ocr vc destroy");}// 活体人脸比对界面创建回调- (void)faceMainViewCreate:(UIView *)authView {[self addCustomLabel:authView];}// 活体人脸比对界面被回收的回调- (void)faceMainViewDestroy {NSLog(@"ekyc face vc destroy");}- (void)addCustomLabel:(UIView *)authView {UILabel *label = [[UILabel alloc]initWithFrame:CGRectMake(0, 100, 100, 30)];label.backgroundColor = [UIColor blackColor];label.textColor = [UIColor yellowColor];label.text = @"This is a newly added control";label.font = [UIFont systemFontOfSize:20];label.textAlignment = NSTextAlignmentCenter;[authView addSubview:label];}@end
UserUIBundle 构建目标下:demo/└── UserUIBundle/├── TXYOsAuthingViewController.xib # 活体人脸比对页面├── CustOcrView.xib # 证件识别页面├── txy_nav_back.png # 返回按钮图标(可替换)└── txy_waring.png # 提示图标(可替换)
XIB 文件名 | 对应页面 | 说明 |
TXYOsAuthingViewController | 人脸核身页面 | 活体检测与人脸比对的主界面 |
CustOcrView | 卡证识别页面 | OCR 拍摄与识别的主界面 |



demo/ 目录下的工程文件。UserUIBundle 构建目标(Build Target)。TXYOsAuthingViewController.xib 或 CustOcrView.xib 的布局约束,或新增控件。UserUIBundle.bundle。Info.plist 和 _CodeSignature 文件夹。UserUIBundle.bundle 导入宿主工程。VerificationConfig *config = [[VerificationConfig alloc] init];// 指定自定义 UI Bundle 的绝对路径config.userUIBundlePath = [[NSBundle mainBundle] pathForResource:@"UserUIBundle" ofType:@"bundle"];
demo/UserUIBundle/ 整个目录拷贝到宿主工程的代码仓库中,作为自定义 UI 的源码目录,后续所有修改均基于此目录进行。VerificationConfig *config = [[VerificationConfig alloc] init];config.licPath = @"/path/to/license.lic";config.ekycToken = @"your-ekyc-token";// --- 自定义 UI ---config.userUIBundlePath = [[NSBundle mainBundle] pathForResource:@"UserUIBundle" ofType:@"bundle"];config.delegate = self; // 可选:实现 VerificationDelegate 监听 UI 事件// 代码级样式微调(可选,不需要修改 XIB 时使用)config.ocrCustomConfig.rectNormalColor = [UIColor colorWithWhite:1.0 alpha:0.8];config.faceCustomConfig.backgroundColor = [UIColor colorWithRed:0.1 green:0.1 blue:0.1 alpha:1.0];// --- 自定义多语言 ---config.languageType = HY_EKYC_CUSTOMIZE_LANGUAGE;config.userLanguageBundlePath = [[NSBundle mainBundle] pathForResource:@"UserLanguageBundle" ofType:@"bundle"];config.userLanguageFileName = @"ja.lproj";// 启动验证VerificationKit *kit = [[VerificationKit alloc] init];[kit initWithViewController:self];[kit startVerifiWithConfig:config withSuccCallback:^(int errorCode, id resultInfo, id reserved) {// 验证成功} withFialCallback:^(int errorCode, NSString *errorMsg, id reserved) {// 验证失败,错误码 311 表示 Bundle 路径配置异常}];
failCallback 返回以下错误码:错误码 | 枚举 | 触发条件 |
311 | HY_EKYC_BUNDLE_CONFIGURATION_EXCEPTION | 某个 Bundle 路径不存在或不是目录 |
errorMsg)格式为 "<字段名> not found",例如:"userUIBundle not found":userUIBundlePath 指向的路径不存在"userLanguageBundle not found":userLanguageBundlePath 指向的路径不存在旧字段(已删除) | 新字段 | 变更说明 |
userUIBundleName | userUIBundlePath | 由 Bundle 名称改为绝对路径 |
userLanguageBundleName | userLanguageBundlePath | 由 Bundle 名称改为绝对路径 |
// 旧写法(v1.0.1.4 及以下)config.userUIBundleName = @"UserUIBundle";config.userLanguageBundleName = @"UserLanguageBundle";// 新写法(v1.0.1.5 及以上)config.userUIBundlePath = [[NSBundle mainBundle] pathForResource:@"UserUIBundle" ofType:@"bundle"];config.userLanguageBundlePath = [[NSBundle mainBundle] pathForResource:@"UserLanguageBundle" ofType:@"bundle"];
nil,SDK 保持与旧版本相同的默认行为(从 mainBundle 中查找对应 Bundle),不影响未使用自定义功能的接入方。文档反馈