Closed marchein closed 11 months ago
Thank you for your request.
According to our documentation, we currently only support the tag tech types NfcF
and NfcV
on iOS.
Ndef
generally does not support custom commands. But I was able to add support for the tech type MifareDesfire
, which your NFC tag seems to support as well.
⚡️ [log] - {"isWritable":false,"id":[4,156,84,178,62,80,128],"techTypes":["NDEF","MIFARE_DESFIRE"],"historicalBytes":[128],"maxSize":0}
Here you can find a dev version for testing:
npm i @capawesome-team/capacitor-nfc@5.0.2-dev.61fde2a.1703067017
Let me know if it helps you.
Thank you for your quick response.
I was able to let the card scan. But now I receive a new error:
Tag is not connected
⚡️ [log] - --------------- Send Command Select App ---------------
⚡️ [log] - App ID: [95,132,21]
⚡️ [log] - App ID Bytes: [95,132,21]
⚡️ [log] - Select App Command: {"0":144,"1":90,"2":0,"3":0,"4":3,"5":95,"6":132,"7":21,"8":0}
⚡️ [log] - Select App Command Hex: 905a0000035f841500
⚡️ [log] - -------------------- Send NFC Request --------------------
⚡️ [log] - Tag: {"techTypes":["NDEF","MIFARE_DESFIRE"],"historicalBytes":[128],"maxSize":0,"id":[4,156,84,178,62,80,128],"isWritable":false}
⚡️ [log] - techType: MIFARE_DESFIRE
⚡️ [log] - Request: {"0":144,"1":90,"2":0,"3":0,"4":3,"5":95,"6":132,"7":21,"8":0}
⚡️ [log] - Request Hex: 905a0000035f841500
⚡️ [log] - Request Int: 2.6628163300920766e+21
⚡️ [log] - Request Bytes: [144,90,0,0,3,95,132,21,0]
⚡️ To Native -> Nfc transceive 80945129
ERROR MESSAGE: {"errorMessage":"Tag is not connected","message":"Tag is not connected"}
⚡️ [error] - {"errorMessage":"Tag is not connected","message":"Tag is not connected"}
⚡️ [log] - {"errorMessage":"Tag is not connected"}
⚡️ [log] - Response: {}
⚡️ [log] - Response Hex:
⚡️ [log] - Response Int: NaN
This could be related to https://github.com/capawesome-team/capacitor-plugins/issues/125 I guess.
Commited the changes to my repository as well, so you could check please, if you got any ideas how to fix it...
Thank you!
Thank you for the update. I am closing this issue because the original problem has been solved. I will work on capawesome-team/capacitor-plugins#125 next.
I just noticed that capawesome-team/capacitor-plugins#125 only affects Android, not iOS. I tested your example locally and was able to reproduce the problem. I noticed that the error is not thrown by the plugin itself but by this method from Core NFC.
According to this SO thread, the reason for this error message was that an invalid command was sent. So please make sure that you send a valid command to the NFC tag. Unfortunately, I'm not familiar enough with the custom commands for MIFARE DESFire to give you a tip.
EDIT: If you have any further questions, please create a new discussion/issue so that we can deal with the two problems separately.
Plugin version:
"@capawesome-team/capacitor-nfc": "^5.0.2"
Platform(s):
"@capacitor/ios": "^5.6.0",
Current behavior:
Using a NTAG 213 card I read the card, after that I initialize a transceive session I receive an error: "The NFC tag does not support the selected techType."
Expected behavior:
The plugin tells me at least what tech type the card had, but given the output of the nfcTag obj property techTypes states NDEF, it should let me proceed...
Steps to reproduce:
Related code:
See minimal, reproducible example: https://github.com/marchein/capacitor-nfc-techtype-issue
Other information:
Log output from Xcode
Capacitor doctor: