revtel / react-native-nfc-manager

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

Error: mifareClassicWriteBlock fail: TAG_LOST #622

Closed Veronesi closed 1 year ago

Veronesi commented 1 year ago

Hi! I'm having a problem with writing with MifareClassic.

async function writeClassic(){
      await NfcManager.requestTechnology(NfcTech.MifareClassic);
      const SECTOR_TO_WRTIE = 1;
      const TEXT_TO_WRITE = 'test';
      const MIFARE_BLOCK_SIZE = 16;
      const data: Array<number> = Array(MIFARE_BLOCK_SIZE).fill(0);

      const block =
        await NfcManager.mifareClassicHandlerAndroid.mifareClassicSectorToBlock(SECTOR_TO_WRTIE);

      for (
        let i = 0;
        i < MIFARE_BLOCK_SIZE && index < TEXT_TO_WRITE.length;
        i++
      ) {
        data[i] = TEXT_TO_WRITE.charCodeAt(i);
      }

      await NfcManager.mifareClassicHandlerAndroid.mifareClassicWriteBlock(block, data);
}

it throws me the following error

[Error: mifareClassicWriteBlock fail: TAG_LOST]

nfc information:

github-actions[bot] commented 1 year ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

github-actions[bot] commented 1 year ago

This issue was closed because it has been stalled for 5 days with no activity.