Contents

sendCommand(apdu:resultHandler:)

Sends an application protocol data unit (APDU) to the tag and receives a response APDU.

Declaration

@preconcurrency func sendCommand(apdu: NFCISO7816APDU, resultHandler: @escaping  @Sendable (Result<NFCISO7816ResponseAPDU, any Error>) -> Void)
func sendCommand(apdu: NFCISO7816APDU, resultHandler: @escaping (Result<NFCISO7816ResponseAPDU, any Error>) -> Void)

Parameters

  • apdu:

    An application protocol data unit to send to the tag.

  • resultHandler:

    A handler that the reader session invokes after the operation completes. The handler receives a Result with the cases:

    success

    A instance of Nfciso7816responseapdu containing the response from the tag.

    failure

    An Error object indicating that a communication issue with the tag occurred.

Discussion

When you send a SELECT command with a p1Parameter value of 0x04, your app must support one of the applications listed in the ISO7816 application identifiers for NFC Tag Reader Session property list key. Otherwise, the resultHandler receives an NFCReaderError.Code.readerErrorSecurityViolation error.

The session calls resultHandler on the dispatch queue that you provided when creating the NFCTagReaderSession object.

See Also

Sending a Command