Hi there,
I am using Core NFC and I established the connection with the card, (it means that the info.plist is correct and the entitlement should be correct as well). The app detects the card, but after sending the command 'tag.sendCommand()' I receive this message:
[CoreNFC] -[NFCTagReaderSession transceive:tagUpdate:error:]:879 Error Domain=NFCError Code=2 "Missing required entitlement" UserInfo={NSLocalizedDescription=Missing required entitlement}
So, what is missing or what am I doing wrong?
Here is the code:
func tagReaderSession(_ session: NFCTagReaderSession, didDetect tags: [NFCTag]) {
guard !tags.isEmpty else { return }
let hexString = //...
if case let .iso7816(tag) = tags[0] {
session.connect(to: tags[0]) { error in
if let error = error {
print("Error: \(error.localizedDescription)")
return
}
let apdu = hexString.convertToAPDU()
tag.sendCommand(apdu: apdu) { (response: Data, sw1: UInt8, sw2: UInt8, error: Error?) in
// -> here is when the error appears, in the completion
print([UInt8](response)) // print -> []
}
}
}
}