CaptchaFace 1.0.4

CaptchaFace 1.0.4

测试已测试
语言语言 Obj-CObjective C
许可 商业
发布最后一个发布2015年2月

Peter SchaefferPierrickBertrand Villain 维护。



  • wassa

CaptchaFace 是一种通过相机识别多个视觉步骤来识别移动用户是否真实人类的工具。

安装

手动安装

  1. 下载最新的代码版本 下载最新代码版本 或者将仓库作为 git 子模块添加到您的 git 追踪项目中。
  2. 将存档中的 Pod 目录拖到您的项目导航器中。如果在项目外部提取了代码存档,请确保在询问时选择 复制项
  3. 下载 opencv 库 并将 opencv2.framework 拖到您的项目导航器中。
  4. 在项目属性的 构建阶段 > 链接库 中添加 opencv 依赖项
    • libstdc++
    • Accelerate
    • AssetsLibrary
    • AVFoundation
    • CoreGraphics
    • CoreImage
    • CoreMedia
    • CoreVideo
    • Foundation
    • QuartzCore
    • UIKit
  5. 使用Objective-C的#import <CaptchaFace/UIViewController+CaptchaFace.h>或Swift中的import CaptchaFace在任何需要的地方包含 CaptchaFace。

使用方法

要运行示例项目,请克隆仓库,然后首先从 Example 目录运行 pod install。使用 CocoaPods,您可以从命令行运行 pod try CaptchaFace

确保您还能看到 Cocoadocs 上的 CaptchaFace 文档 CaptchaFace 文档在 Cocoadoс

注意:要使用 SDK,您需要从 CaptchaFace 网站 获取 API 密钥。

基础知识

  1. 将以下导入添加到文件顶部或 Swift 的桥接头部

    #import <CaptchaFace/UIViewController+CaptchaFace.h>
  2. 使用

        // Objective-C
        [UIDevice supportsCapchaFace]
        ```
        ```swift
        // Swift
        UIDevice.supportsCapchaFace()
  3. 显示带有默认参数的 captcha view 控制器(必须从任何应用程序的 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
    
    })
    

高级

如果您想要自定义 captchaFace 会话期间显示的事件,您必须创建一个 CaptchaFaceScenario 对象。可以使用 CaptchaFaceScenario 方法以随机事件创建此对象。

  1. 创建一个 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)    
    • 通过创建 CaptchaFaceEvent 的数组来创建固定事件
    // 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)
  1. 使用创建的场景显示验证码视图控制器

    // 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
    
    })
    

需求

  • Xcode 5
  • iOS 7
  • ARC
  • 响应 [UIDevice supportsCapchaFace] 的设备,通常是自 iPhone 4 和 iPad 2 以来 的 iPhone 和 iPad

作者

Wassa, [email protected]