---
title: 接收结果
canonical: https://developer.unico.io/zh-CN/dual-api/developers/sdks-and-tools/ios/capture-flow/receiving-the-result
locale: zh-CN
generated_by: markdown-export
---

SDK 通过在采集会话期间所使用的委托接口中定义的回调来返回采集结果。

## AcessoBioSelfieDelegate

****`onSuccessSelfie`****

当图像成功采集时调用。返回一个 `SelfieResult` 对象，包含：

  - **`base64`** — 采集到的图像；可用于在您的应用中显示预览。
  - **`encrypted`** — JWT 载荷，必须发送至您的后端，以通过 REST API 完成生物特征验证。

  ### Swift

    ```swift
    func onSuccessSelfie(_ result: SelfieResult!) {
      let base64 = result.base64
      let encrypted = result.encrypted // JWT to send to your backend
    }
    ```

### Objective-C

    ```objectivec
    - (void)onSuccessSelfie:(SelfieResult *)result {
      NSString *base64 = result.base64;
      NSString *encrypted = result.encrypted; // JWT to send to your backend
    }
    ```

  :::danger[`encrypted` 使用说明]
  - `encrypted` 属性严格用于通过 Client API 发送图像。不得对其进行打开、序列化或修改操作——其特性可能在未提前告知的情况下发生变化。必须在采集后 **10 分钟**内将其发送至 API。Unico 对因不当处理而造成的任何损失不承担责任。
  - `base64`/`encrypted` 文件的大小可能因设备质量、生成的照片大小以及 Unico 的业务规则而有所不同。**请勿在您的编程逻辑或基础设施中限制** SDK 生成的字符串大小。
  :::

  :::tip[Base64 转位图]
  如果您需要将 `base64` 转换为位图，标准方法在 iOS 上无法直接使用——请先以逗号（`,`）分割字符串。参见 [How to convert a Base64 string into a Bitmap image to show it in an ImageView?](https://stackoverflow.com/questions/4837110/how-to-convert-a-base64-string-into-a-bitmap-image-to-show-it-in-a-imageview)。
  :::

****`onErrorSelfie`****

当采集过程中发生错误时调用。返回一个带有 `getCode()` 和 `getDescription()` 方法的 `ErrorBio` 对象。有关错误代码的完整列表及建议处理方式，请参见[错误处理](/developers/sdks-and-tools/ios/error-handling)。

  ### Swift

    ```swift
    func onErrorSelfie(_ errorBio: ErrorBio!) {
      let code = errorBio.getCode()
      let description = errorBio.getDescription()
    }
    ```

### Objective-C

    ```objectivec
    - (void)onErrorSelfie:(ErrorBio *)errorBio {
      NSString *code = [errorBio getCode];
      NSString *description = [errorBio getDescription];
    }
    ```

## AcessoBioDocumentDelegate

****`onSuccessDocument`****

当文档图像成功采集时调用。返回一个 `DocumentResult` 对象，包含：

  - **`base64`** — 采集到的图像；可用于显示预览。
  - **`encrypted`** — JWT 载荷，必须在 **10 分钟内**发送至您的后端，且绝不能被修改或反序列化。

  ### Swift

    ```swift
    func onSuccessDocument(_ result: DocumentResult!) {
      let base64 = result.base64
      let encrypted = result.encrypted // JWT to send to your backend
    }
    ```

### Objective-C

    ```objectivec
    - (void)onSuccessDocument:(DocumentResult *)result {
      NSString *base64 = result.base64;
      NSString *encrypted = result.encrypted; // JWT to send to your backend
    }
    ```

****`onErrorDocument`****

当文档采集过程中发生错误时调用。返回一个 `ErrorBio` 对象。有关错误代码的完整列表，请参见[错误处理](/developers/sdks-and-tools/ios/error-handling)。

  ### Swift

    ```swift
    func onErrorDocument(_ errorBio: ErrorBio!) {
      let code = errorBio.getCode()
      let description = errorBio.getDescription()
    }
    ```

### Objective-C

    ```objectivec
    - (void)onErrorDocument:(ErrorBio *)errorBio {
      NSString *code = [errorBio getCode];
      NSString *description = [errorBio getDescription];
    }
    ```