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

iOS NFC Read - Once: False (MultiScan) - Not Activating Done #86

Open
ZippyRainbow opened this issue Mar 31, 2021 · 1 comment
Open

Comments

@ZippyRainbow
Copy link

I have an application working in the Android environment with MultiScan (Reader) working fine (Once: False)

But when I try the same function in iOS it can read the first scan and collect the data, but the operating system doesn't acknowledge the scan and is still waiting for a NFC device. If you press Cancel then you can restart and redo a scan.

In iOS, for Single Scan mode it works fine, but I fine that I can only re-read the next card after waiting for around 4 seconds for the NFC to be freed up before I can scan again.

I have tried this on multiple iOS devices and multi versions of flutter, all with the same result.

I am planning on looking into the NfcInFlutterPlugin.m file to see if I can work out where it is going wrong myself. Not something I have done before but I will see how I go.

@ZippyRainbow
Copy link
Author

Okay, I worked out the issue, I started back with the sample Core NFC code from Apple.

For the iOS Multiscan to work (eg once:false, aka invalidateAfterFirstRead:false) you need to use the method readerSession(_:didDetectNDEFs:)
https://developer.apple.com/documentation/corenfc/nfcndefreadersessiondelegate/2875568-readersession

But as per the documentation if you use readerSession(:didDetect:) then readerSession(:didDetectNDEFs:) doesn't fire.

So once I removed readerSession(_:didDetect:) it is now multiscanning in iOS without an issue.

I am now going to make some changes to this NfcInFlutterPlugin.m module to merge the changes into my project

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

1 participant