Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inconsistent Length Byte in NDEF Text Messages on iOS #755

Open
zataara opened this issue Oct 17, 2024 · 0 comments
Open

Inconsistent Length Byte in NDEF Text Messages on iOS #755

zataara opened this issue Oct 17, 2024 · 0 comments

Comments

@zataara
Copy link

zataara commented Oct 17, 2024

When writing a text NDEF message to an NFC tag using the react-native-nfc-manager package, there is an issue where the length byte of the NDEF message is sometimes set to 0, causing the message to be unreadable. This issue only occurs on iOS and behaves inconsistently.

Steps to Reproduce:

  1. Write a text NDEF message to an NFC tag, using a string passed as a parameter to the writeNdef function.
  2. Read the tag to verify the message.
  3. Observe that the length byte is sometimes set to 0.

Notes:

  • The issue does not occur when using a hardcoded string in the writeNdef function. However, when passing the string as a parameter, the length byte can be set to 0.
  • Logged the length and type of the string in both cases (hardcoded vs parameter) and confirmed that both are identical.
  • This issue has only been tested iOS; the behavior on Android has not yet been tested.
  • The issue exists with both a custom built solution and the demo applicaiton found here: https://github.com/revtel/react-native-nfc-rewriter

Expected Behavior:

The length byte should be set correctly regardless of whether the string is hardcoded or passed as a parameter.

Actual Behavior:

In some cases, when passing a string as a parameter, the length byte is set to 0, causing the NDEF message to be unreadable.

Environment:

  • react-native-nfc-manager version: 3.16.0
  • iOS version: 18.1
  • React Native version: 0.72.3

Screenshots

The second byte in Block 0002 is the length byte. Left image was written using this library. Right image was written using NFC Tools application (Native iOS) with same message.
LengthByteMissing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant