ISO14443 - React Native NFC 有时 "Tag connection lost" - 仅在 iOS

ISO14443 - React Native NFC sometimes "Tag connection lost" - only on iOS

背景与问题:

[CoreNFC] 00000002 803f43f0 -[NFCTagReaderSession transceive:tagUpdate:error:]:771  Error Domain=NFCError Code=100 "Tag connection lost" UserInfo={NSLocalizedDescription=Tag connection lost}

这个问题只出现在iOS。 Android 工作正常。


我的沟通方式:

This is how I create the writing commands and how I call my transmit method:

// WRITE COMMAND looks like: [0xA2, Addr, datas]
const writeCommand = [0xa2, offset, data[0], data[1], data[2], data[3]];
const response = await this.transmit(writeCommand);

This is how I create the reading commands:

// FAST_READ COMMAND looks like: [0x3A, StartAddr, EndAddr]
const readCommand = [0x3a, offset, offset + readLength];

And here is my transmit method:

private async transmit(msg: number[]): Promise<number[]> {
  ...
  const cmd = Platform.OS === 'ios' ? NfcManager.sendMifareCommandIOS : NfcManager.transceive;
  return await cmd(msg);
}

我注意到并尝试过的:


如果有任何想法可以帮助我解决这个问题,我将不胜感激。

最后,我设法在多部 iPhone 上试用了我们的应用程序,NFC 工作正常。 我们还发现我们的测试设备是翻新机,我们认为这可能是问题的原因。