> 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` objecto se utiliza para bloquear que la aplicación de pago predeterminada reciba el evento "double-click" o "field detect". Por lo tanto, para aplicaciones de pago que no son la predeterminada, se requiere usar el `NFCPresentmentIntentAssertion` objeto para poder realizar el pago sin contacto.

Desde iOS 18, se requiere usar una aserción de intención de presentación para recibir el evento `ContactlessPaymentSession.Event.posConnected` del SDK TSH Pay, que se basa en el `CardSession.Event.ReaderDetected` evento. Si no utiliza la aserción de intención de presentación, el evento que su aplicación reciba será `NFCWindowSceneEvent.readerDetected` en `SceneDelegate`.<br>

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

* La validez del `NFCPresentmentIntentAssertion` objeto debe mantenerse mientras se muestre contenido NFC, y confiar en una variable local que se desaloca al salir de la función puede resultar en un comportamiento inesperado.
* La aserción de intención de presentación caduca después de 15 segundos y, tras expirar, hay un período de enfriamiento de 15 segundos antes de poder adquirir una nueva instancia. Para asegurar una integración adecuada con `NFCPresentmentIntentAssertion`, debe usarlo como un objeto global para mantener un `isValid` chequeo para reutilizar el existente.
  {% endhint %}

El siguiente fragmento de código demuestra 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 más información, consulte [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.
