> 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/nfc-wallet-sdk-ios/es/implement-nfc-wallet/make-payments/implement-contactless-payment/3.-manage-nfcpresentmentintentassertion.md).

# 3. Gestionar NFCPresentmentIntentAssertion

El `NFCPresentmentIntentAssertion` El objeto se utiliza para impedir que la aplicación de pagos predeterminada reciba el evento "double-click" o "field detect". Por lo tanto, para las aplicaciones de pago que no son predeterminadas, es necesario usar el `NFCPresentmentIntentAssertion` objeto para realizar el pago sin contacto.

Desde iOS 18, debes usar una aserción de presentment intent para recibir el evento `ContactlessPaymentSession.Event.posConnected` de TSH Pay SDK, que se basa en el `CardSession.Event.ReaderDetected` evento. Si no usas la aserción de presentment intent, el evento que recibirá tu aplicación será `NFCWindowSceneEvent.readerDetected` en `SceneDelegate`.<br>

{% hint style="info" %}
Al usar el `NFCPresentmentIntentAssertion` objeto, es importante gestionar correctamente su ciclo de vida.

* La validez de `NFCPresentmentIntentAssertion` objeto debe mantenerse mientras se muestra contenido NFC, y depender de una variable local que se desasigna al salir de la función puede provocar un comportamiento inesperado.
* La aserción de presentment intent expira después de 15 segundos y, una vez expirada, hay un período de enfriamiento de 15 segundos antes de que puedas obtener una nueva instancia. Para garantizar una integración correcta con `NFCPresentmentIntentAssertion`, deberías usarlo como un objeto global para mantener una `isValid` comprobación isValid para reutilizar la existente.
  {% endhint %}

El siguiente fragmento de código muestra cómo usar el `NFCPresentmentIntentAssertion` objeto:

```swift
import CoreNFC

@available(iOS 17.4, *)
class PresentmentIntentWrapper {
    
    static var presentmentIntent: NFCPresentmentIntentAssertion?
    
    static func acquire() async throws {
        presentmentIntent = try await NFCPresentmentIntentAssertion.acquire()
    }
    
    static func isValid() -> Bool {
        guard let presentmentIntent else {
            return false
        }
        return presentmentIntent.isValid
    }
}
```

Para obtener más información, consulta [NFCPresentmentIntentAssertion](https://developer.apple.com/documentation/corenfc/nfcpresentmentintentassertion).


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.payments.thalescloud.io/nfc-wallet-sdk-ios/es/implement-nfc-wallet/make-payments/implement-contactless-payment/3.-manage-nfcpresentmentintentassertion.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
