You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

iOS版reCAPTCHA Enterprise是否支持自定义动作?(Objective-C 18.2.2)

iOS RecaptchaEnterprise 自定义动作字符串(Objective-C)

在RecaptchaEnterprise 18.2.2版本中,虽然RecaptchaAction仅公开了login和signup两个类属性,但你可以通过其公开的初始化方法创建自定义动作字符串,具体实现如下:

  1. 使用initWithAction:方法创建自定义动作实例

    // 替换为你的业务自定义动作名称,比如"checkout"、"submit_form"等
    RecaptchaAction *customAction = [[RecaptchaAction alloc] initWithAction:@"your_custom_action"];
    
  2. 将自定义动作传入验证执行方法

    // 假设你已完成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

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.16 07:11:58