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 configuration object VKCaptchaConfiguration(url:) passes the link to launch the captcha widget, received in the link parameter in the response of method GET /captchaNotRobot.createSession.
Method parameters:
Parameter | Required | Type | Description |
|---|---|---|---|
|
| Link to launch the captcha widget in your application frontend, received in the
|
Configuration call example:
VKCaptchaConfiguration(url: captchaUrl)
The VKCaptcha.getCaptchaViewController(completion:) method displays the captcha to the user in an iOS application. The captcha is displayed as UIViewController and integrates into the application navigation.
Method parameters:
Parameter | Required | Type | Description |
|---|---|---|---|
|
| Callback function with the captcha completion result:
|
Method call example:
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 captcha closing animation. Default value is | |
|
| Callback function after closing the captcha |
Method call example:
captcha.closeCaptcha(animated: true) {print("Captcha closed")}