revtel / react-native-nfc-manager

React Native NFC module for Android & iOS
MIT License
1.32k stars 312 forks source link

SecurityViolation error with isoDepHandler.transceive #708

Closed PraneethGunas closed 5 days ago

PraneethGunas commented 3 months ago

Example code snippet that starts a session with one of the NFC cards with a select command. The session is active until the rfc signal persists. This is lost once the card is far from the NFC receiver... (extraneous/ignore)

  try {
    const headers = Buffer.from('00a404000f', 'hex');
    const selectApp = Buffer.concat([headers, APP_ID]);
    await NfcManager.requestTechnology([NfcTech.IsoDep]);
    const selectResponse = await NfcManager.isoDepHandler.transceive(
      selectApp.toJSON().data
    );
    const { response, status } = decodeAndSplitResponse(selectResponse);
    return { response, status  };
  } catch (error) {
    throw new Error('Initialisation failed');
  }
}

Problem: Following recent iOS 17.x updates, I've encountered an issue where the isoDepHandler.transceive function abruptly ceased functioning, presenting an NFCError:2, specifically NfcErrorIOS indicating a security violation. On quite a bit of digging, it appears this error typically arises when entitlements are absent. However, I've verified that my app.entitlements file includes the necessary listing and it was previously working just fine with older versions of iOS.

    <array>
        <string>NDEF</string>
        <string>TAG</string>
    </array>

and also the below for tag type 4 of ndef payloads

    <array>
        <string>D2760000850100</string>
        <string>D2760000850101</string>
    </array>

Any known reasons for what is happening with recent versions of iOS or anything that I'm missing here?

github-actions[bot] commented 2 weeks 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 5 days ago

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