I am engaged on handing over information by NFC on my iOS smartphone.
So I put in the NFC Reader app on my Android cellphone and am testing it.
An error happens in transmitting information by APDU after discovering out that the tag is ISO7816.
- Add Functionality – Close to Area Communication Tag Studying
- Add instance.entitlements – NFC Tag Reader Session Codecs Tag, NDEF
- Added ISO7816 utility identifiers for NFC ~ Session to Data.plist.
(D2760000850101, A~~~ and so forth) - Test Provisioning
func tagReaderSession(_ session: NFCTagReaderSession, didDetect tags: [NFCTag]) {
guard let firstTag = tags.first else {
session.invalidate(errorMessage: "No tags discovered.")
return
}
session.join(to: firstTag) { (error: Error?) in
if let error = error {
session.invalidate(errorMessage: "Failed to hook up with tag: (error.localizedDescription)")
return
}
change firstTag {
case .miFare(let miFareTag):
self.writeIDToTag(tag: miFareTag, id: "YOUR_IDENTIFIER_STRING", session: session)
case .feliCa(let felicaTag):
NSLog("didDetect_felicaTag")
break
case .iso15693(let iso15693Tag):
NSLog("didDetect_iSO15693")
break
case .iso7816(let iso7816Tag):
NSLog("didDetect_iSO7816")
let information = "ABCDEFGHIJK".information(utilizing: .utf8)
let apduCmd = NFCISO7816APDU(
instructionClass: 0x00,
instructionCode: 0xA4,
p1Parameter: 0x04,
p2Parameter: 0x00,
information: information!,
expectedResponseLength: 256
)
iso7816Tag.sendCommand(apdu: apduCmd) { responseData, sw1, sw2, error in
if let error = error {
session.invalidate(errorMessage: "Did not ship APDU command: (error.localizedDescription)") `// Error: Lacking required entitlement`
}
let statusWord = (sw1 << 8) + sw2
print("APDU Response Knowledge: (responseData), Standing Phrase: (statusWord)")
session.invalidate()
}
break
default:
session.invalidate(errorMessage: "Unsupported tag.")
}
}
}
I checked every little thing, why do I get an error?
Moreover, putting in the NFC Scan app on iOS will trigger this error. connection to service with pid 60 named com.apple.nfcd.service.corenfc: Exception caught throughout decoding of obtained selector didDetectExternalReaderWithNotification:, dropping incoming message. Exception: Exception whereas decoding argument 0 (#2 of invocation): Exception: decodeObjectForKey: class "NFFieldNotificationECP1_0" not loaded or doesn't exist
If anybody is aware of an answer to both of them please.