3. Manage NFCPresentmentIntentAssertion
The NFCPresentmentIntentAssertion object is used to block the default payment application from receiving the "double-click" or "field detect" event. Therefore, for non-default payment applications, it is required to use the NFCPresentmentIntentAssertion object in order to perform the contactless payment.
Since iOS 18, you are required to use presentment intent assertion in order to receive the event ContactlessPaymentSession.Event.posConnected from TSH Pay SDK, which is based on the CardSession.Event.ReaderDetected event. If you do not use the presentment intent assertion, the event that your application received will be NFCWindowSceneEvent.readerDetected in SceneDelegate.
The following code snippet demonstrates how to use the NFCPresentmentIntentAssertion object:
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
}
}For more information, refer to NFCPresentmentIntentAssertion.
Last updated
Was this helpful?