HuiYanOsConfig.languageType:Enumeration Value | Meaning |
HY_DEFAULT | Follow system settings (default) |
HY_CUSTOMIZE_LANGUAGE | Custom language |
HuiYanOsConfig *config = [[HuiYanOsConfig alloc] init];config.languageType = HY_DEFAULT;
demo/ directory, then locate the Localizable under the UserLanguageBundle directory; this part serves as the translation source file.
UserLanguageBundle (Build Target) in the project.
ar.lproj).
Localizable.strings.
Localizable and translate their content:
// The left side is the Key used by the SDK, and the right side is the translation content in the target language."Verifi_OK" = "OK";"Verifi_exit" = "Exit";// ... For the remaining Keys, refer to the Localizable file in the delivery package.
UserLanguageBundle.bundle.
Info.plist and _CodeSignature folders within the Bundle.UserLanguageBundle.bundle into the host project.HuiYanOsConfig *config = [[HuiYanOsConfig alloc] init];// 1. Enable custom language modeconfig.languageType = HY_CUSTOMIZE_LANGUAGE;// 2. Specify the absolute path to the Bundleconfig.languageBundlePath = [[NSBundle mainBundle] pathForResource:@"UserLanguageBundle" ofType:@"bundle"];// 3. Specify the language folder nameconfig.userLanguageFileName = @"ja.lproj";
Required | Type | Required condition | Description |
languageType | Enumeration | Required | Set to HY_CUSTOMIZE_LANGUAGE to enable customization. |
languageBundlePath | NSString * | Required when custom languages are used | The absolute path of UserLanguageBundle |
userLanguageFileName | NSString * | Required when custom languages are used | Target .lproj folder name, such as ja.lproj |
languageBundlePath is nil, the SDK will look for multilingual resources in the mainBundle (default behavior).HuiYanOsConfig *config = [[HuiYanOsConfig alloc] init];// Set the text color for operation error promptsconfig.feedBackErrorColor = 0xFF584C;// Set the text color for operation success promptsconfig.feedBackTxtColor = 0xFF0000;// Set the color of the circular frame for operation error promptsconfig.authCircleErrorColor = 0xFF584C;// Set the color of the circular frame for correct operationsconfig.authCircleCorrectColor = 0x29CC85;// Set the background color of the recognition pageconfig.authLayoutBgColor = 0xFFFFFF;// Set the font and size of the prompt textconfig.feedBackTxtFont = [UIFont systemFontOfSize:18];// Set the font and size of other prompt textconfig.feedbackExtraTxtFont = [UIFont systemFontOfSize:18];// Set the countdown text colorconfig.countDownTxtColor = 0xFFFFFF;// Set the text color of the Cancel buttonconfig.cancelTxtColor = 0xFFFFFF;// Set whether to display the internal dialog box, default is YESconfig.isShowDialog = YES;// Set whether to hide the identity verification avatar guidance box, default is NOconfig.isHideAvatarGuideFrame = NO;
HuiYanOsConfig.delegate, you can monitor the creation and destruction events of the SDK interface and insert custom controls when the identity verification page is displayed:HuiYanOsConfig *config = [[HuiYanOsConfig alloc] init];config.delegate = self; // Implements the HuiYanOverseasDelegate protocol
// HuiYanOverseasDelegate protocol methods@protocol HuiYanOverseasDelegate <NSObject>@required/// Callback when the identity verification main interface is displayed, where authView is the root view presented by the SDK- (void)onMainViewCreate:(UIView *)authView;@optional/// Callback when the identity verification interface is removed.- (void)onMainViewDestroy;@end
@interface ViewController ()<HuiYanOverseasDelegate>@end@implementation ViewController- (void)onMainViewCreate:(UIView *)authView {UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(0, 100, 200, 30)];label.backgroundColor = [UIColor blackColor];label.textColor = [UIColor yellowColor];label.text = @"Custom Label";label.font = [UIFont systemFontOfSize:16];label.textAlignment = NSTextAlignmentCenter;[authView addSubview:label];}- (void)onMainViewDestroy {NSLog(@"huiyan face vc destroy");}@end
Control name | Control description | tag value |
cancelButton | Liveness Verification Page Cancel/Back Button | 101 |
timeoutLabel | Liveness Verification Page Countdown Tag | 102 |
tipsLabel | Liveness Verification Page Prompt Text | 103 |
fakeNavBarView | Liveness Verification Page Virtual Navigation Bar | 200 |
onMainViewCreate: callback, after the identity verification page is created, you can directly access the controls above via viewWithTag: and modify them.- (void)onMainViewCreate:(UIView *)authView {// Modify the cancel button iconUIButton *cancelButton = (UIButton *)[authView viewWithTag:101];UIImage *backImage = [UIImage systemImageNamed:@"chevron.left"];[cancelButton setImage:backImage forState:UIControlStateNormal];// Modify the leading left margin constraint of the Cancel buttonfor (NSLayoutConstraint *constraint in cancelButton.superview.constraints) {if ((constraint.firstItem == cancelButton && constraint.firstAttribute == NSLayoutAttributeLeading) ||(constraint.secondItem == cancelButton && constraint.secondAttribute == NSLayoutAttributeLeading)) {constraint.constant = 16.0;break;}}// Modify the countdown Tag color and fontUILabel *timeoutLabel = (UILabel *)[authView viewWithTag:102];timeoutLabel.textColor = [UIColor whiteColor];timeoutLabel.font = [UIFont systemFontOfSize:15];// Modify the Virtual Navigation Bar background colorUIView *navBarView = [authView viewWithTag:200];navBarView.backgroundColor = [UIColor colorWithRed:0.05 green:0.05 blue:0.1 alpha:1.0];// Add a custom title to the Virtual Navigation BarCGFloat statusBarHeight = [UIApplication sharedApplication].statusBarFrame.size.height;CGRect frame = CGRectMake(0, statusBarHeight, navBarView.bounds.size.width, navBarView.bounds.size.height - statusBarHeight);UILabel *titleLabel = [[UILabel alloc] initWithFrame:frame];titleLabel.text = @"Custom Title";titleLabel.textColor = [UIColor whiteColor];titleLabel.textAlignment = NSTextAlignmentCenter;[navBarView addSubview:titleLabel];}
if (view) { ... }) to prevent crashes when the control does not exist.feedBackErrorColor) and control modifications in callbacks can be used simultaneously. Modifications in callbacks will override the final effect of the corresponding controls.UserUIBundle build target:demo/└── UserUIBundle/└── TXYOsAuthingViewController.xib # Liveness Verification Main Page
XIB file name | Corresponding page | Description |
TXYOsAuthingViewController | Liveness Verification Main Page | Liveness Detection and Face Comparison main page |


demo/ directory.UserUIBundle (Build Target) in the project.TXYOsAuthingViewController.xib as needed, or add new controls.UserUIBundle.bundle.Info.plist and _CodeSignature folders within the Bundle.UserUIBundle.bundle into the host project.HuiYanOsConfig *config = [[HuiYanOsConfig alloc] init];// Specify the absolute path to the HuiYanSDKUI Bundle (required)config.huiyanSdkUIBundlePath = [[NSBundle mainBundle] pathForResource:@"HuiYanSDKUI" ofType:@"bundle"];// Specify the absolute path to the custom UI Bundleconfig.userUIBundlePath = [[NSBundle mainBundle] pathForResource:@"UserUIBundle" ofType:@"bundle"];
demo/UserUIBundle/ to the code repository of the host project as the source code directory for custom UI. All subsequent modifications will be made in this directory for easier version control along with the project.HuiYanOsConfig *config = [[HuiYanOsConfig alloc] init];config.authLicense = [[NSBundle mainBundle] pathForResource:@"license" ofType:@""];// --- Custom UI ---// Bundle path (required)config.huiyanSdkUIBundlePath = [[NSBundle mainBundle] pathForResource:@"HuiYanSDKUI" ofType:@"bundle"];config.faceTrackerBundlePath = [[NSBundle mainBundle] pathForResource:@"face-tracker-v003" ofType:@"bundle"];// Custom UI Bundle (optional)config.userUIBundlePath = [[NSBundle mainBundle] pathForResource:@"UserUIBundle" ofType:@"bundle"];// Code-level style fine-tuning (optional)config.feedBackErrorColor = 0xFF584C;config.authCircleCorrectColor = 0x29CC85;// Implement the delegate to listen to UI events (optional)config.delegate = self;// --- Custom Multilingual ---config.languageType = HY_CUSTOMIZE_LANGUAGE;config.languageBundlePath = [[NSBundle mainBundle] pathForResource:@"UserLanguageBundle" ofType:@"bundle"];config.userLanguageFileName = @"ja.lproj";// Start verification[[HuiYanOSKit sharedInstance] startHuiYaneKYC:@"your-face-token"withConfig:configwithSuccessCallback:^(HuiYanOsAuthResult *authResult, id reserved) {// Verification successful. Use authResult.faceToken to query the result} withFailCallback:^(int errCode, NSString *errMsg, id reserved) {// Verification failed. Error code HY_BUNDLE_CONFIGURATION_EXCEPTION(307) indicates an exception in the Bundle path configuration.}];
failCallback:Error Code | Enumeration | Trigger Condition |
307 | HY_BUNDLE_CONFIGURATION_EXCEPTION | The specified Bundle path either does not exist or is invalid. |
errMsg) example:"HuiYanSDKUI bundle path is not found": The path specified by huiyanSdkUIBundlePath does not exist."face-tracker-v003 bundle path is not found": The path specified by faceTrackerBundlePath does not exist."user bundle is invalid": The path specified by userUIBundlePath does not exist."user language bundle is not found": The path specified by languageBundlePath does not exist.Old field | New field | Change Description |
userUIBundleName | userUIBundlePath | Changed from Bundle name to absolute path. |
userLanguageBundleName | languageBundlePath | Changed from Bundle name to absolute path. |
// Old syntax (v1.0.9.10 and below)config.userUIBundleName = @"UserUIBundle";config.userLanguageBundleName = @"UserLanguageBundle";// New syntax (v1.0.9.11 and above)config.userUIBundlePath = [[NSBundle mainBundle] pathForResource:@"UserUIBundle" ofType:@"bundle"];config.languageBundlePath = [[NSBundle mainBundle] pathForResource:@"UserLanguageBundle" ofType:@"bundle"];
nil, the SDK maintains the same default behavior as the old version (searching for the corresponding Bundle from mainBundle), which does not affect integrators who do not use custom features.Apakah halaman ini membantu?
Anda juga dapat Menghubungi Penjualan atau Mengirimkan Tiket untuk meminta bantuan.
masukan