revtel / react-native-nfc-manager

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

IOS no No ndef available #333

Closed ElegantSoft closed 4 years ago

ElegantSoft commented 4 years ago

I am trying to send data from IOS 13 on IPhone 7 to android device but I get error on IOS while send data

  const sendNFCMessage = async (): Promise<void> => {
    try {
      await NfcManager.start();
      const message = Ndef.encodeMessage([
        Ndef.textRecord(JSON.stringify(data)),
      ]);
      console.log(message);
      await NfcManager.writeNdefMessage(message);
      // resp.
    } catch (e) {
      console.log("error while send nfc message", e);
      cleanNFC();
    }
  };
whitedogg13 commented 4 years ago

Hi @ElegantSoft you can only writeNdefMessage into a NFC tag, not a mobile device. (What you're looking for is called P2P mode, however it's not supported on iOS)