Skip to content
This repository has been archived by the owner on Jun 23, 2024. It is now read-only.

PlatformException on write #98

Open
DasElias opened this issue Sep 7, 2021 · 2 comments
Open

PlatformException on write #98

DasElias opened this issue Sep 7, 2021 · 2 comments

Comments

@DasElias
Copy link

DasElias commented Sep 7, 2021

When I start my app and click a button (which executes the following code), I get a PlatformException(IOError, null, null, null) in the line, where the tag is written. This issue seems to have nothing to do with the tag itself, because when I try to write that particular string in a NFC-write-app, everything works correctly.

  Future<void> nfc() async {
    print("start reading");
    Stream<NDEFMessage> stream = NFC.readNDEF();
    NDEFMessage tag = await stream.first;
    // do something with tag content
    print("read finished");

    NDEFMessage msg = NDEFMessage.withRecords([
      NDEFRecord.text("docmanagement:5a900ee9-003b-4777-9295-a656d8c8810a:aa351a8f-227a-4658-a672-48a319305740"),
    ]);
    await tag.tag.write(msg);
    print("write finished");
  }
@mislavlukach
Copy link

mislavlukach commented Nov 2, 2021

Same thing here. It seems to be working but then it just stops.
You can't write multiple times in a row.
To be more specific, it works 9/10 times.
But this one time I'm constantly getting PlatformException with this error message "write to tag error: Tag is not ndef" which makes no sense since I'm quite sure it's NDEF

@ElegantCrab
Copy link

ElegantCrab commented May 19, 2022

This same problem is affecting me. It worked completely fine before then suddenly this starts happening.

Some insight into the problem: To me, it only happens with empty NFCs, otherwise it works fine.

Update: Running some tests, it only fails when the NFC is not formatted to Ndef on certain phones. On a phone with Android 9 works perfectly but on a phone BISON with Android 11, it seems to fail.

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

No branches or pull requests

3 participants