Package
nfc_manager 4.1.1
Platform
iOS
Summary
Reading an empty / erased NDEF tag on iOS returns:
NFCReaderError.Code.ndefReaderSessionErrorZeroLengthMessage
For apps that support blank or erased tags, this behavior forces consumers to treat an empty tag as a hard failure. In practice, this is more useful as a successful read with no NDEF message.
Actual behavior
Calling readNDEF on an empty tag surfaces an error:
NFCReaderError.Code.ndefReaderSessionErrorZeroLengthMessage
Expected behavior
Return a successful result with nil / empty NDEF content instead of failing the read.
Why this matters
Apps that:
- erase NFC tags
- initialize blank tags
- inspect tags before writing
need to handle empty NDEF tags as a normal state.
Right now, the only workaround is patching the plugin locally.
Proposed fix
In ios/Classes/NfcManagerPlugin.swift, handle ndefReaderSessionErrorZeroLengthMessage as an empty result:
if let readerError = error as? NFCReaderError,
readerError.code == .ndefReaderSessionErrorZeroLengthMessage {
completionHandler(pigeon, nil)
return
}
Package
nfc_manager4.1.1Platform
iOS
Summary
Reading an empty / erased NDEF tag on iOS returns:
NFCReaderError.Code.ndefReaderSessionErrorZeroLengthMessageFor apps that support blank or erased tags, this behavior forces consumers to treat an empty tag as a hard failure. In practice, this is more useful as a successful read with no NDEF message.
Actual behavior
Calling
readNDEFon an empty tag surfaces an error:NFCReaderError.Code.ndefReaderSessionErrorZeroLengthMessageExpected behavior
Return a successful result with
nil/ empty NDEF content instead of failing the read.Why this matters
Apps that:
need to handle empty NDEF tags as a normal state.
Right now, the only workaround is patching the plugin locally.
Proposed fix
In
ios/Classes/NfcManagerPlugin.swift, handlendefReaderSessionErrorZeroLengthMessageas an empty result: