capawesome-team / capacitor-nfc

⚡️ Capacitor plugin for reading and writing NFC tags.
https://capawesome.io/plugins/nfc/
MIT License
73 stars 14 forks source link

bug(ios): NFC reader dialog does not open #4

Closed robingenz closed 2 years ago

robingenz commented 2 years ago

Plugin version:

Platform(s):

Current behavior:

The NFC reader dialog does not open.

import { Nfc, NfcUtils } from '@capawesome-team/capacitor-nfc';

const createNdefTextRecord = async () => {
  const utils = new NfcUtils();
  const { record } = utils.createNdefTextRecord({ text: 'Capacitor NFC Plugin' });
  return record;
};

const write = async () => {
  const record = createNdefTextRecord();

  Nfc.addListener('nfcTagScanned', async (event) => {
    await Nfc.write({ message: { records: [record] } });
  });

  await Nfc.startScanSession();
};

Expected behavior:

The NFC reader dialog should open.

Steps to reproduce:

Related code:

insert short code snippets here

Other information:

Capacitor doctor:

💊   Capacitor Doctor  💊 

Latest Dependencies:

  @capacitor/cli: 4.3.0
  @capacitor/core: 4.3.0
  @capacitor/android: 4.3.0
  @capacitor/ios: 4.3.0

Installed Dependencies:

  @capacitor/cli: 4.3.0
  @capacitor/android: 4.3.0
  @capacitor/core: 4.3.0
  @capacitor/ios: 4.3.0

[success] iOS looking great! 👌
robingenz commented 2 years ago

Temporary Workaround

Add the following to your Info.plist:

<key>com.apple.developer.nfc.readersession.felica.systemcodes</key>
<array>
<string>0003</string>
</array>
<key>com.apple.developer.nfc.readersession.iso7816.select-identifiers</key>
<array>
<string>D2760000850100</string>
<string>D2760000850101</string>
</array>