跳到主要内容

ZaigIosOcrConfiguration


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

let textConfiguration = TextConfiguration()
textConfiguration.setCustomText(on: .onboardingTitle, text: "Vamos começar!")
textConfiguration.setCustomText(on: .onboardingFirstLabel, text: "- Vá para um local com boa luminosidade")
textConfiguration.setCustomText(on: .onboardingSecondLabel, text: "- Retire o documento do plástico")

let ocrConfig = ZaigIosOcrConfiguration(environment: ZaigIosOcrEnvironment.Sandbox,
mobileToken: "41fb4755-9bcf-4ae3-b981-b6009e51ce4a",
sessionId: "288eb399-4936-4133-ab2c-5611d6e5bb7a",
documentSteps: documentSteps,
backgroundColor: "#C9CCD3",
fontColor: "#337DFF",
fontFamily: .open_sans,
showIntroductionScreens: true,
showSuccessScreen: false,
logLevel: .debug
)

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

ZaigIosOcrConfiguration 类用于配置环境、凭证、视觉和文本方面,以及文档图片采集流程,即 SDK 个性化和运行所需的所有配置。

下表详细列出了实例化时需使用的所有参数:

名称类型描述
environmentZaigIosOcrEnvironment(必填) 描述环境的枚举值。
mobileTokenstring(必填) QI Tech 发送的用于 SDK 身份验证的 Token。
sessionIdstring(可选) 用于通过日志跟踪用户在 OCR 执行过程中所经历的完整流程的唯一 ID。此字段最多接受 255 个字符。
documentStepsZaigIosOcrDocumentFlow(必填) 描述将遵循的验证流程的枚举值,定义将采集的文档及图片采集顺序。
backgroundColorstring(可选) 界面背景色的十六进制值。如未提供,默认值为 #FFFFFF。
fontColorstring(可选) 字体颜色的十六进制值。如未提供,默认值为 #000000。
fontFamilyFontFamily(可选) 字体系列。如未提供,默认值为 .open_sans。可用字体:.open_sans、.futura、.verdana、.trebuchetms、.tamilsangammn 和 .system_font。
showIntroductionScreensboolean(可选) 表示是否应显示介绍界面(包含照片拍摄说明)的标志。如未提供,默认值为 true
showSuccessScreenboolean(可选) 表示是否应显示成功界面(包含采集成功消息)的标志。如未提供,默认值为 true
logLevelLogLevel(可选) 用于自定义 SDK 日志详细程度级别。可用级别:LogLevel.debug、LogLevel.info、LogLevel.warn、LogLevel.error 和 LogLevel.trace。如未提供,默认值为 LogLevel.debug。

下表列出了实例接受的所有配置方法:

方法参数描述
setVisualConfigurationvisualConfiguration : VisualConfiguration(可选) 允许修改 SDK 执行过程中显示的图片的类;
setTextConfigurationtextConfiguration : TextConfiguration(可选) 允许修改 SDK 执行过程中显示的文本的类;