revtel / react-native-nfc-manager

React Native NFC module for Android & iOS
MIT License
1.38k stars 317 forks source link

[iOS] Not able to read MIFARE DESFire id #404

Closed mrados7 closed 3 years ago

mrados7 commented 3 years ago

So I have tag when scanned by Android NFC Tools app says its type of NXP MIFARE DESFire. Technologies available are:

But iOS returns just:

{"ndefMessage": [{"id": [], "payload": [], "tnf": 1, "type": []}]}

So I'm missing id and that's the only thing I need :D. Are there any workarounds for iOS, or some other React Native libs that may work? I know this is not iOS restriction cause other apps are able to get ID of tag.

Thanks in advance!

mrados7 commented 3 years ago

Nvm managed to do so with this code:

 try {
      let tech = Platform.OS === "ios" ? NfcTech.MifareIOS : NfcTech.NfcA;
      let resp: any = await NfcManager.requestTechnology(tech, {
        alertMessage: "Ready to do some custom Mifare cmd!"
      });
      console.warn(resp);

      // the NFC uid can be found in tag.id
      let tag = await NfcManager.getTag();
      console.warn(tag);

      if (Platform.OS === "ios") {
        resp = await NfcManager.sendMifareCommandIOS([0x30, 0x00]);
      } else {
        resp = await NfcManager.transceive([0x30, 0x00]);
      }
      console.warn(resp);

      cleanUp();
    } catch (ex) {
      console.warn("ex", ex);
      cleanUp();
    }

Only mifare classic does not work but that is stated in FAQ.

onurmurioglu commented 1 year ago

I am trying to write and read data into the Desfire card, but I am trying to make a react native application that allows this process to take place in the sector I have determined and that the data on the card cannot be changed by others without my permission, but I have not found a useful solution in this regard. I would be very glad if you could help.