References
This page contains references for possible error codes, object structure, etc. Most of this can be obtained from clicking into code via Xcode, but it is also provided here as a reference.
SmartCapture Face Result
Section titled “SmartCapture Face Result”public final class FaceCameraResult: NSObject, NSSecureCoding { public let encryptedBlob: Data public let unencryptedBlob: Data public let previewPhoto: UIImage}The encryptedBlob is what should get sent to the server, while the previewPhoto can be used for on-device preview. It is not recommended to use the previewPhoto for any secure use cases.
Errors
Section titled “Errors”When an error occurs, unless otherwise specified it will be a FaceCameraError,
delivered to your delegate’s didEncounterError(_:).
FaceCameraError is a class, not an enum — the specific failure is carried in
its code property, so switch on error.code rather than on the error itself.
@objc public enum FaceCameraErrorCode: Int, CustomStringConvertible { case cameraPermissionDenied case faceNotDetected case manualCaptureNotAllowed case initializationError case photoCaptureError case unknown
public var description: String { get }}
@objc public class FaceCameraError: NSObject, Error { @objc public let code: FaceCameraErrorCode @objc public let underlyingError: NSError?
@objc public override var description: String { get }}Handling an error
Section titled “Handling an error”func didEncounterError(_ error: FaceCameraError) { switch error.code { case .cameraPermissionDenied: // "Camera permission denied" break case .faceNotDetected: // "Face not detected" break case .manualCaptureNotAllowed: // "Manual capture not allowed" break case .initializationError: // "Initialization error" break case .photoCaptureError: // "Photo capture error" break case .unknown: // "Unknown error" — inspect underlyingError for detail. break @unknown default: break }}FaceCameraErrorCode is a non-frozen enum in a library-evolution build, so include
the @unknown default case — a future release may add codes.
underlyingError
Section titled “underlyingError”Failures that originate in the underlying camera layer carry that error, bridged to
NSError, in underlyingError. Failures raised by the SDK itself leave it nil.
.unknown is the code where underlyingError is the only source of detail: it
covers camera-layer failures with no direct equivalent in FaceCameraErrorCode, and
is also reported — with a nil underlyingError — if building the IAD bundle for
the result fails. Always log it when handling .unknown.
Localization
Section titled “Localization”description, on both FaceCameraError and FaceCameraErrorCode, is localized: it
resolves the smart_capture_* keys listed in
Customization. Branch on code, never on the
message text.