Skip to content

fix(ios): handle empty NDEF tags without waiting for timeout#262

Open
samuelkchris wants to merge 1 commit intookadan:mainfrom
samuelkchris:bugfix/IOTA-2773_fix-ios-empty-ndef-tag-handling
Open

fix(ios): handle empty NDEF tags without waiting for timeout#262
samuelkchris wants to merge 1 commit intookadan:mainfrom
samuelkchris:bugfix/IOTA-2773_fix-ios-empty-ndef-tag-handling

Conversation

@samuelkchris
Copy link
Copy Markdown

@samuelkchris samuelkchris commented Dec 17, 2025

Summary

  • NFCError Code 403 ("NDEF tag does not contain any NDEF message") was being treated as a fatal error
  • During tag discovery, this caused empty tags to be silently skipped, leaving users waiting for the session timeout
  • During explicit NDEF reads, this caused an unhandled failure

Changes

  • Handle error 403 in both readNDEF call sites in ios/Classes/NfcManagerPlugin.swift:
    • Tag discovery (convert function): return the tag with nil cachedNdefMessage instead of skipping it
    • Explicit read (ndefReadNdef): return .success(nil) instead of .failure(error)

Test plan

  • Scan an empty NDEF tag on iOS — should trigger onDiscovered callback immediately with nil NDEF message
  • Scan a tag with NDEF content — should work as before
  • Call Ndef.read() on an empty tag — should return nil instead of throwing
  • Verify other NFC errors are still propagated correctly

Fixes #259

@samuelkchris
Copy link
Copy Markdown
Author

@okadan

@mbcsalmeida
Copy link
Copy Markdown

Running into this error, appreciate the fix from @samuelkchris. Please merge.

NFCError Code 403 ("NDEF tag does not contain any NDEF message") was
causing tags to be silently skipped during discovery and explicit reads.

Handle error 403 in both readNDEF call sites:
- Tag discovery (convert function): return tag with nil cachedNdefMessage
- Explicit read (ndefReadNdef): return success with nil message
@samuelkchris samuelkchris force-pushed the bugfix/IOTA-2773_fix-ios-empty-ndef-tag-handling branch from 1af2774 to 150b9c8 Compare February 6, 2026 08:55
Copy link
Copy Markdown

@Ajinkya-GobetterX Ajinkya-GobetterX left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tiny change but a required one, I am also using similar patched version for my app.

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

Successfully merging this pull request may close these issues.

[IOS] Error Domain=NFCError Code=403 "NDEF tag does not contain any NDEF message"

4 participants