I'm trying to read the data from a NXP Mifare UltraLight tag but I always end up getting the error from CoreNFC: Feature Not Supported
. Am I missing something or am I doing it wrong? Thanks in advance!
func tagReaderSession(_ session: NFCTagReaderSession, didDetect tags: [NFCTag]) {
if case let NFCTag.miFare(tag) = tags.first! {
session.connect(to: tags.first!) { (error: Error?) in
let myAPDU = NFCISO7816APDU(instructionClass:0,
instructionCode:0xB0,
p1Parameter:0,
p2Parameter:0,
data: Data(),
expectedResponseLength:16)
tag.sendMiFareISO7816Command(myAPDU) { response, sw1, sw2, error in
DispatchQueue.main.async {
self.textView.text = """
Identifier: \(tag.identifier.hexDescription)
Family: \(tag.mifareFamily.description)
Historical bytes: \(tag.historicalBytes?.hexDescription ?? "")
SW1: \(sw1), SW2: \(sw2)
Error: \(error?.localizedDescription ?? "No Error")
Response: \(response.hexDescription)
"""
}
guard error != nil && !(sw1 == 0x90 && sw2 == 0) else {
session.invalidate(errorMessage: "Application failure")
return
}
}
}
}
}