You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

iOS端如何启用ISO-DEP Keep Alive数据包避免NFC标签超时断开?

iOS端ISO-DEP保活数据包启用问题

我基于nfc_manager Flutter插件开发了支持Android和iOS的简单应用,用于通过ISO-DEP标签收发APDU数据包。测试中发现Android会自动发送空的ISO-DEP保活数据包,相关日志如下:

NFCRX: b2 67 c7 - 标签接收的内容,其中b2是消息,67c7是CRC
NFCTX: a3 - 标签发送的内容(未包含CRC)
NFCRX: b2 67 c7
NFCTX: a3
NFCRX: b2 67 c7
NFCTX: a3
NFCRX: b2 67 c7
NFCTX: a3
NFCRX: b2 67 c7
NFCTX: a3
NFCRX: b2 67 c7
NFCTX: a3
NFCRX: b2 67 c7
NFCTX: a3
NFCRX: b2 67 c7
NFCTX: a3
NFCRX: b2 67 c7
NFCTX: a3

Android端可以持续发送这类保活包,但iOS端不会主动发送,导致标签很快因超时断开连接。请问能否在iOS端启用这类保活数据包?我的iOS端代码如下:

if (Platform.isIOS)
{
  NfcManager.instance.startSession(
        alertMessage: alertMessage,
        onDiscovered: (NfcTag tag) async {
               
                 tech = Iso7816.from(tag);
                 if (tech is Iso7816) {
                        try{
                              //send a test APDU message
                              Uint8List packet = Uint8List.fromList([0x00, 0xD0, 0x00 , 0x00, 0x02, 0x31, 0x00]);
                              final resp = await Iso7816.from(tag)?.sendCommandRaw(packet);

                              //using the delay to check if there will be the keepalive packets
                              await Future.delayed(const Duration(seconds: 5), () {}); 
                              String resps = resp.toString();
                         }
                         on PlatformException catch (err) {} 
                         catch (err) {}
                 }
          }
  );
}

内容的提问来源于stack exchange,提问作者Vladimir T

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.30 02:35:10