iOS版reCAPTCHA Enterprise是否支持自定义动作?(Objective-C 18.2.2)
iOS RecaptchaEnterprise 自定义动作字符串(Objective-C)
在RecaptchaEnterprise 18.2.2版本中,虽然RecaptchaAction仅公开了login和signup两个类属性,但你可以通过其公开的初始化方法创建自定义动作字符串,具体实现如下:
使用
initWithAction:方法创建自定义动作实例// 替换为你的业务自定义动作名称,比如"checkout"、"submit_form"等 RecaptchaAction *customAction = [[RecaptchaAction alloc] initWithAction:@"your_custom_action"];将自定义动作传入验证执行方法
// 假设你已完成RecaptchaClient实例初始化(self.recaptchaClient) [self.recaptchaClient executeWithAction:customAction completion:^(NSString * _Nullable token, NSError * _Nullable error) { if (error) { // 处理验证失败逻辑 NSLog(@"Recaptcha验证失败: %@", error.localizedDescription); return; } // 验证成功,使用返回的token NSLog(@"Recaptcha Token: %@", token); }];
注意:自定义动作名称建议使用小写字母、数字和下划线组合,避免特殊字符,确保符合Recaptcha的规范要求。
内容的提问来源于stack exchange,提问作者sonyisda1
相关产品推荐
相关产品推荐

