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

# 3. NFCPresentmentIntentAssertionを管理する

この `NFCPresentmentIntentAssertion` オブジェクトは、既定の支払いアプリケーションが「ダブルクリック」または「フィールド検出」イベントを受信するのをブロックするために使用されます。したがって、既定でない支払いアプリケーションの場合、連携型非接触支払いを行うために次の `NFCPresentmentIntentAssertion` オブジェクトを使用する必要があります。

iOS 18以降、TSH Pay SDKからのイベントを受信するには、提示意図アサーション（presentment intent assertion）を使用する必要があります。 `ContactlessPaymentSession.Event.posConnected` これは、 `CardSession.Event.ReaderDetected` イベントに基づいています。提示意図アサーションを使用しない場合、アプリケーションが受信するイベントは `NFCWindowSceneEvent.readerDetected` で `SceneDelegate`.<br>

{% hint style="info" %}
使用する場合、 `NFCPresentmentIntentAssertion` オブジェクトのライフサイクルを適切に管理することが重要です。

* の有効性は、 `NFCPresentmentIntentAssertion` オブジェクトはNFCコンテンツを表示している間に維持されなければならず、関数を抜けると破棄されるローカル変数に依存すると予期しない動作が発生する可能性があります。
* 提示意図アサーションは15秒で期限切れになり、期限切れ後は新しいインスタンスを取得できるまで15秒のクールダウン期間があります。と適切に統合するために、 `NFCPresentmentIntentAssertion`グローバルオブジェクトとして使用して、既存の `isValid` チェックを行い、既存のものを再利用するべきです。
  {% endhint %}

次のコードスニペットは、 `NFCPresentmentIntentAssertion` オブジェクトの使用方法を示しています:

```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
    }
}
```

詳細については、を参照してください [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:

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

The question should be specific, self-contained, and written in natural language.
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.
