logoドキュメント
検索
ログイン

iOS SDK API

GTCaptcha4SessionTaskDelegate

Verification session task delegate protocol

gtCaptchaSession:didReceive:result:

Callback for the result parameters of the verification session.

Declaration

- (void)gtCaptchaSession:(GTCaptcha4Session *)captchaSession didReceive:(NSString *)status result:(nullable NSDictionary *)result;
              
              - (void)gtCaptchaSession:(GTCaptcha4Session *)captchaSession
              didReceive:(NSString *)status
                  result:(nullable NSDictionary *)result;

            
このコードブロックはフローティングウィンドウ内に表示されます

Parameters

|Param|Description| |---- |---- | |captchaSession|Verification session| |status|Status code. @"0"/@"1": Incomplete/Complete.
When status is @"1", it indicates success, and the result needs secondary verification.| |result|Result verification parameters.|

Discussion

After obtaining the verification result parameters, they need to be submitted to the business server to complete parameter verification. result example:

{ pass_token = "eb6d2e064524ae96ddc99a0e6e15f95dbb234008d108f0db269f27d426bcf3c6"; gen_time = "1660894030"; captcha_output = "fI9I34MDjVi10gJO_EqXwNpN8hK0rYLEPVWSDE4W6kc1umDoTHIlD_t6YQNNpPG2tJlKR8he6WFWkkllU8goGeNVNOzhqmAm256BpK8qAEHNrOjHzkNagfIcx_A21ssPrG6YlnnHFx3PfBnbrn5fb2aKDIi0I5xmCUjxq0dsFuANLIQVtllMjkJ7-1l_j-Wz"; captcha_id = "647f5ed2ed8acb4be36784e01556bb71"; lot_number = "0861c607d519469b9117d0c6dd551fe3"; }
              
              {
    pass_token = "eb6d2e064524ae96ddc99a0e6e15f95dbb234008d108f0db269f27d426bcf3c6";
    gen_time = "1660894030";
    captcha_output = "fI9I34MDjVi10gJO_EqXwNpN8hK0rYLEPVWSDE4W6kc1umDoTHIlD_t6YQNNpPG2tJlKR8he6WFWkkllU8goGeNVNOzhqmAm256BpK8qAEHNrOjHzkNagfIcx_A21ssPrG6YlnnHFx3PfBnbrn5fb2aKDIi0I5xmCUjxq0dsFuANLIQVtllMjkJ7-1l_j-Wz";
    captcha_id = "647f5ed2ed8acb4be36784e01556bb71";
    lot_number = "0861c607d519469b9117d0c6dd551fe3";
}

            
このコードブロックはフローティングウィンドウ内に表示されます

gtCaptchaSession:didReceiveError:

Callback for errors occurring during the verification session.

Declaration

- (void)gtCaptchaSession:(GTCaptcha4Session *)captchaSession didReceiveError:(GTC4Error *)error;
              
              - (void)gtCaptchaSession:(GTCaptcha4Session *)captchaSession
         didReceiveError:(GTC4Error *)error;

            
このコードブロックはフローティングウィンドウ内に表示されます

Parameters

|Param|Description| |---- |---- | |captchaSession|Verification session| | error |Error description object|

Seealso

Error

GTCaptcha4Session

Verification session

delegate

Verification session task delegate.

Declaration

@property (nonatomic, weak) id<GTCaptcha4SessionTaskDelegate> delegate;
              
              @property (nonatomic, weak) id<GTCaptcha4SessionTaskDelegate> delegate;

            
このコードブロックはフローティングウィンドウ内に表示されます

captchaID

Verification ID of the current session.

Declaration

@property (nonnull, readonly, nonatomic, strong) NSString *captchaID;
              
              @property (nonnull, readonly, nonatomic, strong) NSString *captchaID;

            
このコードブロックはフローティングウィンドウ内に表示されます

challenge

Serial number of the current verification session.

Declaration

@property (nullable, readonly, nonatomic, strong) NSString *challenge;
              
              @property (nullable, readonly, nonatomic, strong) NSString *challenge;

            
このコードブロックはフローティングウィンドウ内に表示されます

configuration

Configuration of the current verification session.

Declaration

@property (nonnull, readonly, nonatomic, strong) GTCaptcha4SessionConfiguration *configuration;
              
              @property (nonnull, readonly, nonatomic, strong) GTCaptcha4SessionConfiguration *configuration;

            
このコードブロックはフローティングウィンドウ内に表示されます

sessionWithCaptchaID:

Create a new verification session instance.

Declaration

+ (instancetype)sessionWithCaptchaID:(NSString *)captchaID;
              
              + (instancetype)sessionWithCaptchaID:(NSString *)captchaID;

            
このコードブロックはフローティングウィンドウ内に表示されます

Parameters

Param |Description | ----------|--------------- | captchaID |Verification ID|

Return Value

A new GTCaptcha4Session instance

sessionWithCaptchaID:configuration:

Create a new verification session instance.

Declaration

+ (instancetype)sessionWithCaptchaID:(NSString *)captchaID configuration:(nullable GTCaptcha4SessionConfiguration *)configuration;
              
              + (instancetype)sessionWithCaptchaID:(NSString *)captchaID
                       configuration:(nullable GTCaptcha4SessionConfiguration *)configuration;

            
このコードブロックはフローティングウィンドウ内に表示されます

Param |Description | ----------|--------------- | captchaID |Verification ID| configuration |Session configuration|

Return Value

A new GTCaptcha4Session instance

initWithCaptchaID:

Create a new verification session instance.

Declaration

- (instancetype)initWithCaptchaID:(NSString *)captchaID;
              
              - (instancetype)initWithCaptchaID:(NSString *)captchaID;

            
このコードブロックはフローティングウィンドウ内に表示されます

Parameters

Param |Description | ----------|--------------- | captchaID |Verification ID|

Return Value

A new GTCaptcha4Session instance

initWithCaptchaID:configuration:

Create a new verification session instance.

Declaration

- (instancetype)initWithCaptchaID:(NSString *)captchaID configuration:(nullable GTCaptcha4SessionConfiguration *)configuration;
              
              - (instancetype)initWithCaptchaID:(NSString *)captchaID
                    configuration:(nullable GTCaptcha4SessionConfiguration *)configuration;

            
このコードブロックはフローティングウィンドウ内に表示されます

Param |Description | ----------|--------------- | captchaID |Verification ID| configuration |Session configuration|

Return Value

A new GTCaptcha4Session instance

verify

Start verification.

Declaration

- (void)verify;
              
              - (void)verify;

            
このコードブロックはフローティングウィンドウ内に表示されます

cancel

Cancel verification.

Declaration

- (void)cancel;
              
              - (void)cancel;

            
このコードブロックはフローティングウィンドウ内に表示されます

sdkVersion

Get the SDK version number.

Declaration

+ (NSString *)sdkVersion;
              
              + (NSString *)sdkVersion;

            
このコードブロックはフローティングウィンドウ内に表示されます

GTCaptcha4SessionConfiguration

Verification session configuration

GTC4UserInterfaceStyle

Verification interface style.

Declaration

typedef NS_ENUM(NSInteger, GTC4UserInterfaceStyle) { /** Follow system style */ GTC4UserInterfaceStyleSystem = 0, /** Light style */ GTC4UserInterfaceStyleLight, /** Dark style */ GTC4UserInterfaceStyleDark, /** Default style */ GTC4UserInterfaceStyleDefault = GTC4UserInterfaceStyleLight };
              
              typedef NS_ENUM(NSInteger, GTC4UserInterfaceStyle) {
    /** Follow system style */
    GTC4UserInterfaceStyleSystem = 0,
    /** Light style */
    GTC4UserInterfaceStyleLight,
    /** Dark style */
    GTC4UserInterfaceStyleDark,
    /** Default style */
    GTC4UserInterfaceStyleDefault = GTC4UserInterfaceStyleLight
};

            
このコードブロックはフローティングウィンドウ内に表示されます

resourcePath

The complete path for remote access to static resources, default is empty.

Declaration

@property (nullable, nonatomic, strong) NSString *resourcePath;
              
              @property (nullable, nonatomic, strong) NSString *resourcePath;

            
このコードブロックはフローティングウィンドウ内に表示されます

protocol

The protocol used for remote access to static resources, default is @“https”.

Declaration

@property (nonatomic, strong) NSString *protocol;
              
              @property (nonatomic, strong) NSString *protocol;

            
このコードブロックはフローティングウィンドウ内に表示されます

userInterfaceStyle

The interface and status bar style, default is plain white.

Declaration

@property (nonatomic, assign) GTC4UserInterfaceStyle userInterfaceStyle;
              
              @property (nonatomic, assign) GTC4UserInterfaceStyle userInterfaceStyle;

            
このコードブロックはフローティングウィンドウ内に表示されます

backgroundColor

Background color, default is transparent.

Declaration

@property (nonatomic, strong) UIColor *backgroundColor;
              
              @property (nonatomic, strong) UIColor *backgroundColor;

            
このコードブロックはフローティングウィンドウ内に表示されます

debugEnable

Debug mode switch, default is off.

Declaration

@property (nonatomic, assign) BOOL debugEnable;
              
              @property (nonatomic, assign) BOOL debugEnable;

            
このコードブロックはフローティングウィンドウ内に表示されます

backgroundUserInteractionEnable

Interaction with the background, default is enabled.

Declaration

@property (nonatomic, assign) BOOL backgroundUserInteractionEnable;
              
              @property (nonatomic, assign) BOOL backgroundUserInteractionEnable;

            
このコードブロックはフローティングウィンドウ内に表示されます

timeout

Request timeout duration, default is 8 seconds.

Declaration

@property (nonatomic, assign) NSTimeInterval timeout;
              
              @property (nonatomic, assign) NSTimeInterval timeout;

            
このコードブロックはフローティングウィンドウ内に表示されます

language

Language, default follows the system. For specific languages, refer to language short codes.

Declaration

@property (nonatomic, strong) NSString *language;
              
              @property (nonatomic, strong) NSString *language;

            
このコードブロックはフローティングウィンドウ内に表示されます

supportedInterfaceOrientations

Supported screen orientations.

Declaration

@property (assign, nonatomic) UIInterfaceOrientationMask supportedInterfaceOrientations;
              
              @property (assign, nonatomic) UIInterfaceOrientationMask supportedInterfaceOrientations;

            
このコードブロックはフローティングウィンドウ内に表示されます

additionalParameter

Additional parameters, default is empty. The parameters will be assembled and submitted to engagelab.

Declaration

@property (nullable, nonatomic, strong) NSDictionary *additionalParameter;
              
              @property (nullable, nonatomic, strong) NSDictionary *additionalParameter;

            
このコードブロックはフローティングウィンドウ内に表示されます

Discussion

The supported key-value list is as follows:

|Key|Type|Description|Default Value| |---- |---- |----- | ------ | |@"loading"|NSString|Custom loading state indicator, relative path of the loading resource for WebView loading html. Setting an empty string cancels the loading.|@"./gt4-loading.gif"| |@"rem"|NSNumber|Set the overall scaling ratio of the verification code.|@(1)| |@"hideBar"|NSArray<NSString *> *|Hide the close button and refresh button on subsequent verification screens. Setting @[@"close", @"refresh"] hides the close and refresh buttons.|@[]| |@"nextWidth"|NSString|The width of the verification code popup, with units such as @"300px".|nil| |@"riskType"|NSString|Specify the verification type in conjunction with risk control integration.|nil| |@"hideSuccess"|NSNumber |Hide the verification success popup, @(0)/@(1) for not hiding or hiding.|@(0)|

Sample Code

#define captchaID @"1234567890abcdef" GTCaptcha4SessionConfiguration *config = [GTCaptcha4SessionConfiguration defaultConfiguration]; NSMutableDictionary *params = [@{} mutableCopy]; [params setValue:@(1.25) forKey:@"rem"]; // Scale up by 1.25 times [params setValue:@[@"close", @"refresh"] forKey:@"hideBar"]; // Hide close and refresh buttons [params setValue:@"300px" forKey:@"nextWidth"]; [params setValue:@"click" forKey:@"riskType"]; // Specify smart click verification, consistent with backend configuration [params setValue:@(1) forKey:@"hideSuccess"]; // Use NSNumber to represent boolean value [params setValue:@"./gt4-loading.gif" forKey:@"loading"]; config.additionalParameter = params; GTCaptcha4Session *captchaSession = [GTCaptcha4Session sessionWithCaptchaID:captchaID configuration:config]; ...
              
              #define captchaID @"1234567890abcdef"

GTCaptcha4SessionConfiguration *config = [GTCaptcha4SessionConfiguration defaultConfiguration];

NSMutableDictionary *params = [@{} mutableCopy];
[params setValue:@(1.25)                  forKey:@"rem"]; // Scale up by 1.25 times
[params setValue:@[@"close", @"refresh"]  forKey:@"hideBar"]; // Hide close and refresh buttons
[params setValue:@"300px"                 forKey:@"nextWidth"];
[params setValue:@"click"                 forKey:@"riskType"]; // Specify smart click verification, consistent with backend configuration
[params setValue:@(1)                     forKey:@"hideSuccess"]; // Use NSNumber to represent boolean value
[params setValue:@"./gt4-loading.gif"     forKey:@"loading"];

config.additionalParameter = params;

GTCaptcha4Session *captchaSession = [GTCaptcha4Session sessionWithCaptchaID:captchaID configuration:config];
...

            
このコードブロックはフローティングウィンドウ内に表示されます

defaultConfiguration

Obtain a default configuration.

Declaration

+ (GTCaptcha4SessionConfiguration *)defaultConfiguration;
              
              + (GTCaptcha4SessionConfiguration *)defaultConfiguration;

            
このコードブロックはフローティングウィンドウ内に表示されます

Return Value

+ (GTCaptcha4SessionConfiguration *)defaultConfiguration { GTCaptcha4SessionConfiguration *config = [[GTCaptcha4SessionConfiguration alloc] init]; config.debugEnable = NO; config.timeout = 8.0; config.language = [GTC4Utils systemLanguage]; config.protocol = @"https"; config.userInterfaceStyle = GTC4UserInterfaceStyleDefault; config.backgroundColor = [UIColor clearColor]; config.backgroundUserInteractionEnable = YES; return config; }
              
              + (GTCaptcha4SessionConfiguration *)defaultConfiguration {
    GTCaptcha4SessionConfiguration *config = [[GTCaptcha4SessionConfiguration alloc] init];
    config.debugEnable  = NO;
    config.timeout      = 8.0;
    config.language     = [GTC4Utils systemLanguage];
    config.protocol     = @"https";
    config.userInterfaceStyle = GTC4UserInterfaceStyleDefault;
    config.backgroundColor = [UIColor clearColor];
    config.backgroundUserInteractionEnable = YES;
    
    return config;
}

            
このコードブロックはフローティングウィンドウ内に表示されます

Error

Error description object

/// Invalid parameter. Please check the input parameters. FOUNDATION_EXPORT NSString * const GTC4ErrorCodeInvalidParameter; /// Operation failed. Check the detailed description. FOUNDATION_EXPORT NSString * const GTC4ErrorCodeOperationFail; /// Resource missing. Please check if the GTCaptcha4.bundle file is complete. FOUNDATION_EXPORT NSString * const GTC4ErrorCodeMissedResource; /// User canceled the verification. FOUNDATION_EXPORT NSString * const GTC4ErrorCodeUserDidCancel; /// Failed to load the file. Please check if the complete GTCaptcha4.bundle file is imported or if the configured remote static resource is accessible. FOUNDATION_EXPORT NSString * const GTC4ErrorCodeLoadFileFailure; /// Loading timeout. FOUNDATION_EXPORT NSString * const GTC4ErrorCodeTimeout; /// Failed to execute Javascript script. FOUNDATION_EXPORT NSString * const GTC4ErrorCodeEvaluatingJavascriptFail; /// Javascript returned an error. FOUNDATION_EXPORT NSString * const GTC4ErrorCodeJavascriptError; /// WebView memory warning. FOUNDATION_EXPORT NSString * const GTC4ErrorCodeWebViewMemoryWarning; /// Unknown error. FOUNDATION_EXPORT NSString * const GTC4ErrorCodeUnknown;
              
              /// Invalid parameter. Please check the input parameters.
FOUNDATION_EXPORT NSString * const GTC4ErrorCodeInvalidParameter;
/// Operation failed. Check the detailed description.
FOUNDATION_EXPORT NSString * const GTC4ErrorCodeOperationFail;
/// Resource missing. Please check if the GTCaptcha4.bundle file is complete.
FOUNDATION_EXPORT NSString * const GTC4ErrorCodeMissedResource;

/// User canceled the verification.
FOUNDATION_EXPORT NSString * const GTC4ErrorCodeUserDidCancel;

/// Failed to load the file. Please check if the complete GTCaptcha4.bundle file is imported or if the configured remote static resource is accessible.
FOUNDATION_EXPORT NSString * const GTC4ErrorCodeLoadFileFailure;
/// Loading timeout.
FOUNDATION_EXPORT NSString * const GTC4ErrorCodeTimeout;
/// Failed to execute Javascript script.
FOUNDATION_EXPORT NSString * const GTC4ErrorCodeEvaluatingJavascriptFail;
/// Javascript returned an error.
FOUNDATION_EXPORT NSString * const GTC4ErrorCodeJavascriptError;
/// WebView memory warning.
FOUNDATION_EXPORT NSString * const GTC4ErrorCodeWebViewMemoryWarning;

/// Unknown error.
FOUNDATION_EXPORT NSString * const GTC4ErrorCodeUnknown;

            
このコードブロックはフローティングウィンドウ内に表示されます

code

Error code. Can be used for matching and handling.

Declaration

@property (readonly, nonatomic, strong) NSString *code;
              
              @property (readonly, nonatomic, strong) NSString *code;

            
このコードブロックはフローティングウィンドウ内に表示されます

Seealso

Refer to the error code list above.

msg

Error message. Can be used for user interface display.

Declaration

@property (readonly, nonatomic, strong) NSString *msg;
              
              @property (readonly, nonatomic, strong) NSString *msg;

            
このコードブロックはフローティングウィンドウ内に表示されます

desc

Detailed error description. Used for detailed troubleshooting.

Declaration

@property (readonly, nonatomic, strong) NSDictionary *desc;
              
              @property (readonly, nonatomic, strong) NSDictionary *desc;

            
このコードブロックはフローティングウィンドウ内に表示されます

Discussion

Can be used to support operational issues in user verification.

icon
お問い合わせ