> For the complete documentation index, see [llms.txt](https://docs.payments.thalescloud.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.payments.thalescloud.io/merchant-tokenization/es/integracion-del-sdk/integration/ios.md).

# iOS

Use esta guía para integrar el **SDK de Thales** en una aplicación nativa de iOS para comerciantes.

## Paquete de entrega <a href="#delivery-packages" id="delivery-packages"></a>

El paquete de entrega del SDK incluye:

<table><thead><tr><th width="100">Nombre</th><th>Descripción</th></tr></thead><tbody><tr><td>Binarios</td><td>Variantes de lanzamiento y depuración del SDK de Thales.</td></tr><tr><td>Demostración</td><td>Proyecto de ejemplo que muestra cómo integrar y usar el SDK de Thales.</td></tr><tr><td>Apidoc</td><td>Documentación de la API del SDK de Thales.</td></tr><tr><td>Licencia</td><td>Licencias de frameworks de terceros incluidos con el SDK de Thales.</td></tr></tbody></table>

## Integrar el SDK <a href="#application-integration" id="application-integration"></a>

1. Cree una carpeta llamada `Framework`.
2. Copie los `.xcframework` paquetes desde `Binaries/<Release|Debug>/` dentro de la `Framework` carpeta.

<figure><img src="/files/199942b36d769554134bfde81524c9c2556cbb3f" alt=""><figcaption><p>Ejemplo <code>Framework</code> carpeta que contiene los <code>.xcframework</code> paquetes del SDK.</p></figcaption></figure>

3. Arrastre `TMGSDK.xcframework` y `SecureLogAPI.xcframework` desde la `Framework` carpeta a **Frameworks, Libraries, and Embedded Content** en la configuración de su objetivo.

<figure><img src="/files/d1e8bb12abef74109dbe070c147441ce1fe58e57" alt=""><figcaption><p>Incorpore los frameworks del SDK en el objetivo de su aplicación.</p></figcaption></figure>

4. Agregue la descripción del uso de Face ID al `Info.plist`.

<figure><img src="/files/3c5276abe605479da27f297c573dd8834d9f1831" alt=""><figcaption><p>Agregue la descripción del uso de Face ID en <code>Info.plist</code>.</p></figcaption></figure>

## Configurar el SDK <a href="#sdk-configuration" id="sdk-configuration"></a>

Configure el SDK de Thales antes de llamar a cualquier API del SDK.

Construya un `TMGClientConfiguration` con los parámetros requeridos:

* URL del servidor
* Certificado del servidor
* Identificador de clave
* PINs del certificado

#### 1. Cree un `TMGClientConfiguration`

Obtenga la URL del servidor, el certificado del servidor y el identificador de clave durante el registro.

```swift
let serverURL = ""
let serverCertificate = ""
let serverKeyID = ""
let configuration = TMGClientConfiguration(serverURL: serverURL,
                                           serverCertificate: Data(serverCertificate.utf8),
                                           serverKeyID: serverKeyID)
```

#### 2. Cree un `VisaCTFHelper`

Cree el asistente para iniciar el vinculado del dispositivo y autenticar transacciones para Visa CTF y DAF.

```swift
do {
      let visaCTFHelper = try TMGClient.sharedInstance.createVisaCTFHelper(withConfiguration: configuration)
} catch let error {
  // Manejar el error
}
```

#### 3. Cree un `MastercardTAFHelper`

Cree el asistente para iniciar el vinculado del dispositivo y autenticar transacciones para Mastercard TAF.

```swift
do {
      let mastercardTAFHelper = try TMGClient.sharedInstance.createMastercardTAFHelper(withConfiguration: configuration)
  } catch let error {
      // Manejar el error
  }
```

Si el SDK no puede crear el asistente, lanza un error.

{% hint style="info" %}
Use cada variante del SDK solo para su entorno previsto. Cuando crea un `VisaCTFHelper`, el SDK devuelve `deviceEnvironmentUnsafe` en estos casos:

* `Debug`: Firma la aplicación con un certificado de distribución o ad-hoc.
* `Release`: Depura la aplicación, o la inicias desde Xcode o `xcodebuild`. Si encuentra este error, deje de depurar y vuelva a iniciar la aplicación en el dispositivo.
  {% endhint %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.payments.thalescloud.io/merchant-tokenization/es/integracion-del-sdk/integration/ios.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
