revtel / react-native-nfc-manager

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

iOS 15 on iPhone 7 - NfcError of Security violation #611

Closed gcantara closed 1 year ago

gcantara commented 1 year ago

Hi, I developed and published an Android application, where NfcManager works perfectly for my behaviors.

Now I have to do same things with iOs system.

I have enabled "expo-dev-client" to deploy my app on the device. I'm able to call NfcManager.start() without issues.

I modified the .plist and the .entitlements files like said on https://github.com/hansemannn/iOS11-NFC-Example and my app can be installed after that.

But when I call "await NfcManager.requestTechnology(NfcTech.Ndef)" the application got an error: at node_modules/react-native-nfc-manager/src/NfcError.js:1:38 in at node_modules/react-native-nfc-manager/src/NfcError.js:3:25 in NfcErrorBase at node_modules/react-native-nfc-manager/src/NfcError.js:1:38 in at node_modules/react-native-nfc-manager/src/NfcError.js:5:30 in SecurityViolation at node_modules/react-native-nfc-manager/src/NfcError.js:91:36 in buildNfcExceptionIOS at node_modules/react-native-nfc-manager/src/NfcError.js:156:36 in handleNativeException

What I'm still wrong? Where can I have take a look?

Many thanks for Help.

Gianfranco

gcantara commented 1 year ago

I solved my issue.

I was on the plist file, I added those lines: `NFCReaderUsageDescription

We need to use NFC
<key>com.apple.developer.nfc.readersession.formats</key>
  <array>
      <string>TAG</string>
  </array>
<key>com.apple.developer.nfc.readersession.iso7816.select-identifiers</key>
<array>
  <string>D2760000850100</string>
  <string>D2760000850101</string>
</array>`

and in the entitlements: `com.apple.developer.nfc.readersession.formats

TAG NDEF ` Regards.