Closed maganap closed 4 years ago
Have you tried the newly released version 2.0.4? It should have fixed this issue.
Same issue.
One of my users is reporting this issue in my app, as well, on an iPhone 11. I'm unable to reproduce on my iPhone 8. Haven't tried my other devices.
Says it happens when he cancels out, though it's hard to reproduce. It locks up iOS's NFC handler completely, and you can't get the NFC scan dialog to show up in any app until a complete device restart.
I'm having a similar problem. To reproduce on iOS:
Any help would be greatly appreciated!
Thx!
=====
Update: the error seems a bit non-deterministic. Sometimes it works, sometimes it doesn't. I'm trying to figure out if it is a timing issue (e.g. if you cancel a stream too quickly, it fouls up the NFC processing pipeline?) In its current state, I'm not sure I could deploy an app in production given the erratic nature of this. Again, any help to resolve would be greatly appreciated!
=====
Another update: After cancelling the iOS dialog, the next time I try to start a reading session, an exception is immediately thrown, "Bad State: no element", which is typically associated with a .where clause in dart that results in zero items selected.
I have opened PR #39 which could fix this issue.
It definitely fixes not being able to scan a tag after manually closing the iOS popup or letting it timeout.
I would like to ask all of you to clone the code and do your best to mess with CoreNFC and see if it ever stops working.
Also if you any of you could tell me if you're able to scan more than one tag in the same session. I could never get it to scan more than one tag before timing out, and I don't know if it's a bug in nfc_in_flutter or CoreNFC because the CoreNFC documentation is, well.. not great
If you would like to use the code from the PR in your apps, you can set the nfc_in_flutter version in pubspec.yaml
to the PR ref like so:
dependencies:
nfc_in_flutter:
git:
url: git://github.com/semlette/nfc_in_flutter.git
ref: simplify-error-handling-plus-fix
Will get to it this afternoon! Thanks! Jw
HUGE improvement! Still need to run through a more full suite of tests, but early indications look GREAT!
It looks like reading works great, but the fix for reading tags seems to have triggered a regression in the ability to write tags. Before, I was able to write and now unable to do so. If you need any data from me on this, please let me know. Thx! J
I've spent most of the day building an app for testing nfc_in_flutter, and I've just begun adding tests for writing, so I've just had a look at this.
I am still able to write using the writeNDEF()
function, but it's definitely not working as intended.
When writing using writeNDEF()
, it triggers the NSLog
on line 76 in NfcInFlutterPlugin.,m
. Adding another NSLog
to log the error (can't believe I didn't add that in the first place) reveals that the error is "Session invalidated by user". I wonder what's causing this. Continuing to investigate.
@James-A-White could you perhaps describe in better detail how the writing doesn't work for you? Android, iOS? Any platform-level logs from Android Studio or Xcode? Exceptions in Flutter?
I also now understand the behaviour in my comment above. I may have been a little too fast on the trigger. The error comes from invalidating the session because the Flutter-side stream is complete - because writeNDEF()
is.
It's believe it's the expected behaviour.
I've pulled your latest code and am trying to get writing to work. On the positive side, the reading of tags is much more reliable now, even after cancelling. I think you can close this issue and we can move this discussion to issue #38.
I merged the PR because it seemed to fix this issue, but i am reluctant to release it, if it did indeed create a new bug related to writing.
Discussion on the potential new bug shall continue in #38
Hi, i still have this problem on iphone 7, even applying the branch, is it solved if I put throwOnUserCancel to false, but in that case I don't know when the user has canceled, is it supposed to be solved? thanks.
same issue here also.
Hello!
I'm working with one time reading in iOS, as in:
NFC.readNDEF(once: true, throwOnUserCancel: true);
Problem: When reading starts, the iOS native NFC dialog comes up. If the user cancels and requests reading again, the dialog won't come up anymore.
More info:
NFCUserCanceledSessionException
(only the first time, of course, since there's no more native dialog after cancelling the first time).Tested on a real device, iPhone X iOS 13.3.1
Any ideas what the cause of this problem could be? Thanks in advance!