Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add "iosRestartPolling" method #151

Merged
merged 1 commit into from
Feb 21, 2024
Merged

Conversation

rostopira
Copy link
Contributor

Sometimes I'm receiving "Tag connection lost" even if tag isn't moving
And I have to execute over 400 commands in a row, so starting again or reconnecting isn't an option, since you can't get rid of all those "awesome" animation and it takes a second on each exception.
I've added iosRestartPolling method which calls NFCTagReaderSession.restartPolling() in Swift and it solves the issue for me.
I hope this will help someone else

@Harry-Chen Harry-Chen merged commit 868c3f3 into nfcim:master Feb 21, 2024
1 check passed
@Harry-Chen
Copy link
Contributor

Thanks!

@rostopira
Copy link
Contributor Author

Usage example:

try {
  // Do something like transceive
} on PlatformException catch (e) {
  if (e.details != "Tag connection lost") {
    await reconnectToTag();
    await tryThisAgain();
  } else {
    await FlutterNfcKit.iosRestartPolling();
    await tryThisAgain();
  }
}

@rostopira
Copy link
Contributor Author

@Harry-Chen any plans to push new version to pubdev?

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

Successfully merging this pull request may close these issues.

None yet

2 participants