【问题标题】:Flutter NFC on iOS not working, after pressing "cancel" in nfc-scan-popup在 nfc-scan-popup 中按“取消”后,iOS 上的 Flutter NFC 无法正常工作
【发布时间】:2020-01-24 21:03:41
【问题描述】:

我正在使用以下插件来读取我的 nfc-tag:https://pub.dev/packages/nfc_in_flutter

首先 - 很棒的插件!

我只是遇到了这个问题,当在这个 iOS NFC 扫描弹出窗口上按“取消”时(见下图)。 当我在设备上按“取消”时,nfc 不再工作。我的想法是,我的应用程序已经使用了 nfc,需要发布。

这里是一段代码,我开始阅读标签:

NFC.isNDEFSupported.then((bool isSupported) async {
  if (isSupported) {
    try {
      NDEFMessage message = await NFC.readNDEF(once: true).first;
      print(message.payload);
    } catch (e) {
      print(e.toString());
    }
  }
});

因此,如果我按“取消”一次并尝试再次扫描我的 nfc-tag,我将收到以下错误: PlatformException(SessionTerminatedUnexpectedlyError, Session 意外失效, null)

【问题讨论】:

标签: ios flutter plugins nfc


【解决方案1】:

我是 nfc_in_flutter 插件的作者。

我已经发布了 2.0.4 版本,应该可以解决这个问题。修复是submitted by another user,但问题是阅读会话在准备好之前就被无效了。

【讨论】:

    猜你喜欢
    • 2021-10-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-11-07
    • 2019-04-21
    • 1970-01-01
    相关资源
    最近更新 更多