跳到主要内容

ZaigIosFaceRecognitionConfiguration

SDK 5.0.0 及以后版本

let visualConfiguration = VisualConfiguration()
visualConfiguration.setOnboarding(onboardingFilePath: Bundle.main.path(forResource: "onboarding", ofType: "png")!, onboardingWidth: 200)

let textConfiguration = TextConfiguration()
textConfiguration.setCustomText(on: .onboardingTitle, text: "Para tirar uma boa foto:")
textConfiguration.setCustomText(on: .onboardingFirstLabel, text: "- Vá para um local iluminado")
textConfiguration.setCustomText(on: .onboardingSecondLabel, text: "- Retire adereços e mostre bem o rosto")
textConfiguration.setCustomText(on: .onboardingThirdLabel, text: "- Insira seu rosto na moldura, aguardando que fique verde para realizar a captura")

let faceRecognitionConfig = ZaigIosFaceRecognitionConfiguration(environment: ZaigIosFaceRecognitionEnvironment.Sandbox,
clientSessionKey: clientSessionKey,
sessionId: "7d8c6f9a-f222-450d-9501-a07c68eb2388",
backgroundColor: "#C9CCD3",
fontColor: "#337DFF",
fontFamily: .open_sans,
showIntroductionScreens: true,
showSuccessScreen: false,
showInvalidTokenScreen: true,
activeFaceLiveness: true,
audioConfiguration: AudioConfiguration.Enable,
logLevel: .debug
)

faceRecognitionConfig.setVisualConfiguration(visualConfiguration: visualConfiguration)
faceRecognitionConfig.setTextConfiguration(textConfiguration: textConfiguration)

ZaigIosFaceRecognitionConfiguration 类用于配置环境、凭据、视觉和文本方面,即 SDK 个性化和运行所需的所有配置。

下表包含实例化时必须使用的所有参数的详细信息:

名称类型描述
environmentZaigIosFaceRecognitionEnvironment(必填) 描述环境的枚举器。
sessionIdstring(可选) 用于通过日志跟踪用户在 FaceRecon 执行过程中完整流程的唯一 ID。此字段最多接受 255 个字符。
clientSessionKeystring(必填) 由 face recognition API 发送的用于 SDK 认证的令牌。
backgroundColorstring(可选) 屏幕背景颜色的十六进制值。若未指定,默认为 #FFFFFF。
fontColorstring(可选) 字体颜色的十六进制值。若未指定,默认为 #000000。
fontFamilyFontFamily(可选) 字体系列。若未指定,默认为 .open_sans。可用字体:.open_sans、.futura、.verdana、.trebuchetms、.tamilsangammn 和 .system_font。
showIntroductionScreensboolean(可选) 指示是否显示介绍屏幕(包含照片拍摄方式的说明)的标志。若未指定,默认为 true
showSuccessScreenboolean(可选) 指示是否显示成功屏幕(包含采集成功消息)的标志。若未指定,默认为 true
showInvalidTokenScreenboolean(可选) 指示是否显示认证失败屏幕(包含令牌过期消息)的标志。若未指定,默认为 true
activeFaceLivenessboolean(可选) 指示 SDK 是否执行用户自拍采集或主动活体检测程序。若未指定,默认为 false
audioConfigurationAudioConfiguration(可选) 指示 SDK 是否为用户播放提示音频。接受的配置为:Enable(始终播放提示音频)、Disable(从不播放音频)和 Accessibility(当用户设备启用了无障碍配置时播放音频)。
logLevelLogLevel(可选) 用于自定义 SDK 日志的详细级别。可用级别:LogLevel.debug、LogLevel.info、LogLevel.warn、LogLevel.error 和 LogLevel.trace。若未指定,默认为 LogLevel.debug。

下表包含实例可接受的所有配置方法:

方法参数描述
setVisualConfigurationvisualConfiguration : VisualConfiguration(可选) 允许修改 SDK 执行过程中显示的图片的类;
setTextConfigurationtextConfiguration : TextConfiguration(可选) 允许修改 SDK 执行过程中显示的文本的类;
setDocumentNumber用于设置用户的文档号码。此字段接受格式为 000.000.000-00 的 14 位 CPF 字符如果某次调用使用了 1:1 验证,则所有调用均必填。
setValidation用于定义 SDK 是否对用户的自拍照执行 1:1 验证。在用户的第一次会话中,此标志必须为 false。此功能需要填写 setDocumentNumber 方法。否。默认值为 false

旧版本

配置

let visualConfiguration = VisualConfiguration()
visualConfiguration.setOnboarding(onboardingFilePath: Bundle.main.path(forResource: "onboarding", ofType: "png")!, onboardingWidth: 200)

let textConfiguration = TextConfiguration()
textConfiguration.setCustomText(on: .onboardingTitle, text: "Para tirar uma boa foto:")
textConfiguration.setCustomText(on: .onboardingFirstLabel, text: "- Vá para um local iluminado")
textConfiguration.setCustomText(on: .onboardingSecondLabel, text: "- Retire adereços e mostre bem o rosto")
textConfiguration.setCustomText(on: .onboardingThirdLabel, text: "- Insira seu rosto na moldura, aguardando que fique verde para realizar a captura")

let faceRecognitionConfig = ZaigIosFaceRecognitionConfiguration(environment: ZaigIosFaceRecognitionEnvironment.Sandbox,
mobileToken: "41fb4755-9bcf-4ae3-b981-b6009e51ce4a",
sessionId: "7d8c6f9a-f222-450d-9501-a07c68eb2388",
backgroundColor: "#C9CCD3",
fontColor: "#337DFF",
fontFamily: .open_sans,
showIntroductionScreens: true,
showSuccessScreen: false,
activeFaceLiveness: true,
audioConfiguration: AudioConfiguration.Enable,
logLevel: .debug
)

faceRecognitionConfig.setVisualConfiguration(visualConfiguration: visualConfiguration)
faceRecognitionConfig.setTextConfiguration(textConfiguration: textConfiguration)

参数表

名称类型描述
environmentZaigIosFaceRecognitionEnvironment(必填) 描述环境的枚举器。
sessionIdstring(可选) 用于通过日志跟踪用户在 FaceRecon 执行过程中完整流程的唯一 ID。此字段最多接受 255 个字符。
mobileTokenstring(必填) QI Tech 发送的用于 SDK 认证的令牌。
backgroundColorstring(可选) 屏幕背景颜色的十六进制值。若未指定,默认为 #FFFFFF。
fontColorstring(可选) 字体颜色的十六进制值。若未指定,默认为 #000000。
fontFamilyFontFamily(可选) 字体系列。若未指定,默认为 .open_sans。可用字体:.open_sans、.futura、.verdana、.trebuchetms、.tamilsangammn 和 .system_font。
showIntroductionScreensboolean(可选) 指示是否显示介绍屏幕(包含照片拍摄方式的说明)的标志。若未指定,默认为 true
showSuccessScreenboolean(可选) 指示是否显示成功屏幕(包含采集成功消息)的标志。若未指定,默认为 true
activeFaceLivenessboolean(可选) 指示 SDK 是否执行用户自拍采集或主动活体检测程序。若未指定,默认为 false
audioConfigurationAudioConfiguration(可选) 指示 SDK 是否为用户播放提示音频。接受的配置为:Enable(始终播放提示音频)、Disable(从不播放音频)和 Accessibility(当用户设备启用了无障碍配置时播放音频)。
logLevelLogLevel(可选) 用于自定义 SDK 日志的详细级别。可用级别:LogLevel.debug、LogLevel.info、LogLevel.warn、LogLevel.error 和 LogLevel.trace。若未指定,默认为 LogLevel.debug。