semlette / nfc_in_flutter

Cross-platform flutter plugin for reading and writing NFC tags. Not maintained anymore - not looking for new maintainer, fork instead.
MIT License
119 stars 119 forks source link

Error: NDEF Tag does not contain any NDEF Message on iOS #87

Closed Nico1911 closed 3 years ago

Nico1911 commented 3 years ago

Hello, I tried to build an NFC App and it works still fine - beside one big problem. When I want to describe a newly purchased NFC tag, already formatted for NDEF, with my app, this does not work with the error code: ERROR: NDEF tag does not contain any NDEF message. However, if I open another NFC app from the AppStore, it works perfectly with the tag. It is also strange that once I have written a text to the tag with another NFC App, my app now works perfectly and I can now write to the tag.

So my question is, why can I only write NFC tags with my app that already contain a message?

I would also be interested to know how I could programme my app so that it can also write to empty tags. Since this also works with the other app from the AppStore, it must be possible with iOS.

Many thanks in advance to all those who take the time to deal with my question.

https://stackoverflow.com/questions/67147077/flutter-error-ndef-tag-does-not-contain-any-ndef-message-on-ios/67153374#67153374

vilvic commented 3 years ago

I believe I have fixed this on my fork of the project. I am able to read and write an empty NDEF tag. I have also added null safety support.

If you're interested in the fix the change was made in NfcInFlutterPlugin.m line 493

if (error != nil && error.code != 403) {

I'm not an iOS Developer. I found the solution here https://github.com/chariotsolutions/phonegap-nfc/commit/d34cc427e4f52fa3e25ec8aa563558c5bde04f81

https://github.com/vilvic/nfc_in_flutter

Nico1911 commented 3 years ago

Thank you!