跳到主要内容

iOS、Android & React Native

适用于 iOS (Swift / Objective-C)、Android (Kotlin / Java) 和 React Native 的原生封装会打开一个全屏 WebView,从托管页面运行与 Web SDK 相同的引擎,因此各平台的采集行为一致,引擎更新无需发布新版本即可到达您的应用。运行时需要摄像头,并能联网访问 https://iapp.co.th/sdk/webview.html。

所有封装都提供相同的流程:

安装并运行流程​

  1. 需要 iOS 15+,并在 Info.plist 中添加 NSCameraUsageDescription。
  2. 在 Xcode 中选择 File → Add Package Dependencies…,输入 https://github.com/iapp-technology/iapp-ekyc-sdk,添加 product IappEkyc。
  3. 启动流程并处理结果。
import IappEkyc

let config = IappEkycConfig(apiKey: "YOUR_API_KEY", flow: .documentCapture)
config.documentType = .thaiIdFront // .thaiIdBack .passport .thaiDriverLicense .bookBank .thaiIdWithSignature
config.locale = .th // .en / .th / .zh

IappEkycSdk.present(from: self, config: config) { result in
switch result {
case .success(let outcome):
print(outcome.document?.rawJSON ?? [:]) // 完整的 OCR 响应
case .failure(let error as NSError)
where error.code == IappEkycErrorCode.cancelled.rawValue:
break // 用户取消
case .failure(let error):
print(error.localizedDescription) // error.code: IappEkycErrorCode
}
}

主动活体检测返回服务器签名的判定结果:

let config = IappEkycConfig(apiKey: "YOUR_API_KEY", flow: .activeLiveness)
IappEkycSdk.present(from: self, config: config) { result in
if case .success(let outcome) = result, let liveness = outcome.liveness {
// 在您的后端验证 verdictJSON + signature — 切勿在设备上信任
// `passed` 标志。
upload(liveness.verdictJSON, liveness.signature, liveness.selfieImageData)
}
}

Objective-C 通过委托使用相同的类:

@import IappEkyc;

IappEkycConfig *config = [[IappEkycConfig alloc] initWithApiKey:@"YOUR_API_KEY"
flow:IappEkycFlowTypeDocumentCapture];
config.documentType = IappEkycDocumentTypeThaiIdFront;
[IappEkycSdk presentFrom:self config:config delegate:self];
// 实现 IappEkycViewControllerDelegate: didFinishWithResult / didFailWithError / didCancel

共同行为​

  • API 密钥:传入 apiKey: "" 并将 baseUrl 设为您自己的后端,即可把密钥保留在服务器端。密钥在桥接页加载后注入,绝不经过 URL。SECURITY.md
  • 主题与语言:与 Web SDK 相同的令牌和 en / th / zh 语言,通过各平台的配置对象设置。
  • 活体判定:只有服务器签名的判定结果才能证明通过。信任 passed 之前,请在您的后端重新计算其 HMAC;参见人脸主动活体检测。
  • 取消:流程内的取消按钮、Android 返回键和 iOS 下滑关闭都会返回取消结果;关闭或卸载流程会干净地中止它。
  • 桥接协议:封装与引擎之间的完整协议见 WEBVIEW_BRIDGE.md。

© 2026 iApp Technology Co., Ltd.服务条款隐私政策系统状态sale@iapp.co.th