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