CocoaPods trunk is moving to be read-only. Read more on the blog, there are 19 months to go.
TestsTested | ✗ |
LangLanguage | Obj-CObjective C |
License | Commercial |
ReleasedLast Release | Feb 2015 |
Maintained by Peter Schaeffer, Pierrick, Bertrand Villain.
CaptchaFace is a tool that allows you to know if a mobile user is really human by identification of several visual steps through the camera.
#import <CaptchaFace/UIViewController+CaptchaFace.h>
from Objective-C or import CaptchaFace
from Swift.To run the example project, clone the repo, and run pod install
from the Example directory first. With CocoaPods , you can run pod try CaptchaFace
from the command line.
Make sure you also see CaptchaFace documentation on Cocoadocs.
Attention : To use the SDK, you need a API key that you can get on the CaptchaFace website
Add the following import to the top of the file or the bringing header for swift:
#import <CaptchaFace/UIViewController+CaptchaFace.h>
Check if the user can run CaptchaFace using :
// Objective-C
[UIDevice supportsCapchaFace]
```
```swift
// Swift
UIDevice.supportsCapchaFace()
Show the captcha viewController with default parameters ( have to be called from any application's ViewController )
// Objective-C
[self showCaptchaViewControllerWithLicenceKey:@"<your_key>" completion:^(NSError *error, int successCount, int totalCount) {
//Handle success and failure, see CaptchaFaceViewController.m in the Sample project for examples
}];
// Swift
self.showCaptchaViewControllerWithLicenceKey("<your_key>", completion: { (error:NSError!,successCount:Int32, totalCount:Int32) -> Void in
//Handle success and failure, see CaptchaFaceSwiftViewController.swift in the Sample project for examples
})
If you want to personalize the event shown during the captchaFaceSession, you have to create a CaptchaFaceScenario object. This object can be created with random events in a range with the method :
Create a CaptchaFaceScenario :
// Objective-C
NSRange eventsRange= {3,2};
//3 to 5 random events will be played
CaptchaFaceScenario *scenario = [CaptchaFaceScenario scenarioWithRandomEvents:eventsRange intervalBetweenEvents:1.0 failureTimeInterval:5.0];
// Swift
let eventsRange = NSMakeRange(3, 2)
//3 to 5 random events will be played
let scenario = CaptchaFaceScenario(randomEvents: eventsRange, intervalBetweenEvents: 1.0, failureTimeInterval: 5.0)
// Objective-C
NSArray *events = @[[CaptchaFaceEvent smile],[CaptchaFaceEvent moveBackward],[CaptchaFaceEvent moveForward]];
CaptchaFaceScenario *scenario = [CaptchaFaceScenario scenarioWithEvents:events intervalBetweenEvents:1.0 failureTimeInterval:5.0];
// Swift
let events = [CaptchaFaceEvent.smile(),CaptchaFaceEvent.moveBackward(),CaptchaFaceEvent.moveForward()]
let scenario = CaptchaFaceScenario(events: events, intervalBetweenEvents: 1.0, failureTimeInterval: 5.0)
Show the captcha viewController with the created scenario :
// Objective-C
[self showCaptchaViewControllerWithLicenceKey:@"<your_key>" scenario: scenario completion:^(NSError *error, int successCount, int totalCount) {
//Handle success and failure, see CaptchaFaceViewController.m in the Sample project for examples
}];
// Swift
self.showCaptchaViewControllerWithLicenceKey("<your_key>", scenario: scenario completion: { (error:NSError!,successCount:Int32, totalCount:Int32) -> Void in
//Handle success and failure, see CaptchaFaceSwiftViewController.swift in the Sample project for examples
})
Wassa, [email protected]