> For the complete documentation index, see [llms.txt](https://docs.facephi.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.facephi.com/docs.facephi-en/products/idv-suite/flujos-and-integraciones/configuracion-tecnica-del-cliente/sdk-mobile/ios-sdk/modulos/subida-de-ficheros-y-gestion-de-qr.md).

# File Upload and QR Management

This component requires a minimum iOS 14 version

## Introduction

File upload and the reading and generation of QR Codes are performed with the ***Capture Component***.

This component allows document upload by taking a photo with the device camera or from the gallery. FileUploader, QR Reader and QR Generator use the KMP Widget **FPHICaptureWidget** (it has no native UI of its own). Its main features are:

* Document upload via camera or gallery.
* QR Code reading.
* QR Code generation.

In the [Initialization](/docs.facephi-en/products/idv-suite/flujos-and-integraciones/configuracion-tecnica-del-cliente/sdk-mobile/ios-sdk/inicializacion.md) the steps required for the basic Integration of the SDK are detailed. This section adds the information for the launch of this component.

***

## Dependencies

To avoid conflicts and compatibility issues, if you want to install the component in a project that contains an old Version of the Facephi libraries (Widgets), these must be completely removed before installing the components of the **SDKMobile**.

### **CocoaPods**

* Currently, Facephi libraries are distributed remotely through different dependency managers, in this case CocoaPods. The dependencies **mandatory** that must have been installed beforehand (by adding them to the project's Podfile) are:

```swift
pod 'FPHISDKMainComponent', '~> $VERSION'
```

* To install the Capture component, the following entry must be included in the application's Podfile:

```swift
pod 'FPHISDKCaptureComponent', '~> $VERSION'
```

### **SPM**

* The mandatory dependencies that must have been installed beforehand are:

```swift
//HTTPS
https://github.com/facephi-clienters/SDK-SdkPackage-SPM.git
//SSH
git@github.com:facephi-clienters/SDK-SdkPackage-SPM.git
```

* To install the SelphID component, it must be included in the project's modules:

<pre class="language-swift"><code class="lang-swift"><strong>//HTTPS
</strong>https://github.com/facephi-clienters/SDK-CapturePackage-SPM.git
//SSH
git@github.com:facephi-clienters/SDK-CapturePackage-SPM.git
</code></pre>

***

## Available controllers <a href="#id-3-controladores-disponibles" id="id-3-controladores-disponibles"></a>

| **Controller**         | **Description**                 |
| ---------------------- | ------------------------------- |
| FileUploaderController | Controller for document capture |
| QrReaderController     | Controller for QR capture       |
| QrGeneratorController  | Controller for QR generation    |

***

## Error handling <a href="#id-6-recepcion-del-resultado" id="id-6-recepcion-del-resultado"></a>

Errors will be returned as a 'CaptureError' object.

List of errors:

* CAP\_ACTIVITY\_RESULT\_MSG\_ERROR: The result returned by the activity is incorrect or does not contain the necessary information to continue.
* CAP\_APPLICATION\_CONTEXT\_ERROR: The required application context is null or invalid, preventing the capture module from being initialized correctly.
* CAP\_CAMERA\_ERROR: An internal error related to the device camera has occurred (failure to open, Initialization, or capture).
* CAP\_CAMERA\_PERMISSION\_DENIED: The user has denied the permissions required to access the camera.
* CAP\_CANCEL\_BY\_USER: The user has manually canceled the capture process.
* CAP\_CANCEL\_LAUNCH: The process has been generally canceled by the SDK or by an external action.
* CAP\_COMPONENT\_LICENSE\_ERROR: The component License is not valid, has expired, or does not match the required configuration.
* CAP\_EMPTY\_LICENSE: The License string is empty or has not been provided.
* CAP\_FETCH\_DATA\_ERROR: An error occurred while fetching or processing the data required to execute the Flow. *(Includes additional information in the field `error`.)*
* CAP\_FLOW\_ERROR: An internal error occurred during the execution of the capture Flow. *(Includes additional information in the field `error`.)*
* CAP\_INITIALIZATION\_ERROR: Error while initializing the necessary SDK components. *(Includes detailed information in the field `error`.)*
* CAP\_FILE\_UPLOADER\_CAPTURE\_ERROR: Error during the process of uploading the files generated in the capture.
* CAP\_IMAGE\_TOO\_LARGE: The image selected from the gallery exceeds the maximum size configured in `maxGalleryImageSizeKb`.
* CAP\_MANAGER\_NOT\_INITIALIZED: The managers required to execute the process have not been initialized correctly.
* CAP\_NO\_DATA\_ERROR: The required input data are null, nonexistent, or insufficient to continue the process.
* CAP\_OPERATION\_NOT\_CREATED: It was not possible to create or retrieve an active operation required to continue. *(Includes detailed information in the field `error`.)*
* CAP\_QR\_CAPTURE\_ERROR: Error during the capture or reading of the QR Code.
* CAP\_QR\_GENERATION\_ERROR: Error while generating the requested QR Code.
* CAP\_TIMEOUT: The maximum allowed time has been reached in one of the phases of the process.
* CAP\_FLOW\_VIDEO\_RECORDING\_ERROR: Error during video recording within the established Flow.
* CAP\_FLOW\_TRACKING\_ERROR: Error while performing the Tracking required to complete the capture Flow.

## Document capture configuration <a href="#id-7-configuracion-de-la-captura-de-documentos" id="id-7-configuracion-de-la-captura-de-documentos"></a>

In `FileUploaderConfigurationData`, together with parameters such as `allowGallery` and `maxScannedDocs`, the behavior of selection from the gallery can be adjusted:

* `onlyGalleryMode`: Opens the Flow directly in gallery mode, without showing the camera capture. By default `true`.
* `maxGalleryImageSizeKb`: Maximum size allowed for images selected from the gallery, in KB. By default `2048`. If an image exceeds this limit, the component returns `CAP_IMAGE_TOO_LARGE`.
