RecaptchaEnterprise Framework Reference

Recaptcha


@interface Recaptcha : NSObject

Interface to interact with reCAPTCHA.

  • Builds a new reCAPTCHA Client for the given Site Key and timeout.

    The SDK supports one Site Key. Passing a different Site Key will throw an exception.

    Declaration

    Swift

    class func fetchClient(withSiteKey siteKey: String) async throws -> RecaptchaClient

    Objective-C

    + (void)fetchClientWithSiteKey:(nonnull NSString *)siteKey
                        completion:(nonnull void (^)(RecaptchaClient *_Nullable,
                                                     NSError *_Nullable))completion;

    Parameters

    siteKey

    reCAPTCHA Site Key for the app.

    completion

    Callback function to return the RecaptchaClient or an error.

  • Builds a new reCAPTCHA Client for the given Site Key and timeout.

    The SDK supports one Site Key. Passing a different Site Key will throw an exception.

    At least a 10000 millisecond timeout is suggested to allow for slow networking, though in some cases longer timeouts may be necessary. The minimum allowable value is 5000 milliseconds.

    Declaration

    Swift

    class func getClient(withSiteKey siteKey: String, withTimeout timeout: Double) async throws -> RecaptchaClient

    Objective-C

    + (void)getClientWithSiteKey:(nonnull NSString *)siteKey
                     withTimeout:(double)timeout
                      completion:(nonnull void (^)(RecaptchaClient *_Nullable,
                                                   NSError *_Nullable))completion;

    Parameters

    siteKey

    reCAPTCHA Site Key for the app.

    timeout

    Timeout for getClient in milliseconds.

    completion

    Callback function to return the RecaptchaClient or an error.

  • Builds a new reCAPTCHA Client for the given Site Key.

    The SDK supports one Site Key. Passing a different Site Key will throw an exception.

    This method will timeout after 10 seconds.

    Declaration

    Swift

    class func getClient(withSiteKey siteKey: String) async throws -> RecaptchaClient

    Objective-C

    + (void)getClientWithSiteKey:(nonnull NSString *)siteKey
                      completion:(nonnull void (^)(RecaptchaClient *_Nullable,
                                                   NSError *_Nullable))completion;

    Parameters

    siteKey

    reCAPTCHA Site Key for the app.

    completion

    Callback function to return the RecaptchaClient or an error.

  • Deprecated

    Use the new method getClient(withSiteKey:timeout:completion:)

    Builds a new reCAPTCHA Client for the given SiteKey.

    This method will timeout after 10 seconds.

    Declaration

    Swift

    class func getClient(siteKey: String) async -> (RecaptchaClient?, RecaptchaError?)

    Objective-C

    + (void)getClientWithSiteKey:(nonnull NSString *)siteKey
               completionHandler:
                   (nonnull void (^)(RecaptchaClient *_Nullable,
                                     RecaptchaError *_Nullable))completionHandler;

    Parameters

    siteKey

    reCAPTCHA Site Key for the app.

    completionHandler

    Callback function to return the RecaptchaClient or an error.