SDK reference for iOS
- iOS version 12 and above;
- Xcode version 16.2 and above;
- Swift Package Manager version 5.9 and above;
- CocoaPods version 1.13 and above.
The VKCaptchaConfiguration(url:) configuration object passes the link for launching the captcha widget, received in the link parameter in the response of the GET /captchaNotRobot.createSession method.
Method parameters:
Parameter | Required | Type | Description |
|---|---|---|---|
|
| The link for launching the captcha widget in your application's frontend, received in the
|
Example of a configuration call:
VKCaptchaConfiguration(url: captchaUrl)
The VKCaptcha.getCaptchaViewController(completion:) method displays the captcha to the user in an iOS application. The captcha is displayed as a UIViewController and is integrated into the application navigation.
Method parameters:
Parameter | Required | Type | Description |
|---|---|---|---|
|
| Callback function with the captcha completion result:
|
Example of a method call:
captcha.getCaptchaViewController { [weak self] result inswitch result {case .success(let token):self?.repeatRequest(with: token)case .failure:// Handling captcha closurebreak}
The VKCaptcha.closeCaptcha(animated:completion:) method closes the captcha widget.
Method parameters:
Parameter | Required | Type | Description |
|---|---|---|---|
|
| Flag for the captcha closing animation. Default value is | |
|
| Callback function called after the captcha is closed |
Example of a method call:
captcha.closeCaptcha(animated: true) {print("Captcha closed")}