ios - 当 TLV 字段使用 3 字节长度格式时,CoreNFC 不会读取

标签 ios nfc ndef iso-15693 core-nfc

当 NDEF 长度超过 256 字节时,无法从 CoreNFC 获得任何响应,因此需要使用 3 字节字段而不是 1 字节字段。我应该注意的是,标签都可以在 Android 上读取。

其他人可以确认此行为或帮助我了解如何指定文件以便 CoreNFC 识别并读取该文件吗?

所以这有效,

// TLV header
// Start of Type (T) field
0x03,         // This message contains an NDEF record
// End of Type (T) field

// Start of Length (L) field
// Length = payload length + length of value field
0xFE,         // Length field, adds 3 to account for length of value field when SR:1
// End of Length (L) field

// Start of Value (V) field
// Record head byte, MB:1,ME:1,CF:0,SR:1,IL:0,TNF:101
0xD5,         // Short record false SR:1, 1-byte payload length, unknown type        
0x00,         // Type set to zero, as specified for unknown type
0xFB,         // Payload length
// End of Value (V) field
// End of TLV header

但事实并非如此,

// TLV header
// Start of Type (T) field
0x03,         // This message contains an NDEF record
// End of Type (T) field

// Start of Length (L) field
// Length = payload length + length of value field
0xFF,         // Always 0xFF for SR:0, indicates length is between 256 and 65535
0x01,         // MSB of length field
0xF2,         // LSB of length field, adds 6 to account for length of value field when SR:0
// End of Length (L) field

// Start of Value (V) field
// Record head byte, MB:1,ME:1,CF:0,SR:0,IL:0,TNF:101
0xC5,         // Short record false SR:0, 4-byte payload length, unknown type        
0x00,         // Type set to zero, as specified for unknown type
0x00,         // MSB of payload length, should be the exact size of the payload (data)
0x00,
0x01,
0xEC,         // LSB of payload length
// End of Value (V) field
// End of TLV header

最佳答案

原来问题是由兼容性容器中的设置引起的。 Apple 可以使用 CoreNFC 读取两种类型的 NDEF,如果您将“IC 支持 ReadMultipleBlocks 命令”的位设置为 false,它可以正常工作。我们将其设置为 true。这是与 CoreNFC 配合使用的 CC 示例。

    // Start of Compatibility Container
0xE1,         // CC0, "Magic Number", NDEF message is present in memory
0x43,         // CC1, Version number 1.0, Read access enabled, Write access normally disabled
0x40,         // CC2, Memory size of data field and CC field in bytes divided by 8, 0x40 = 64, 64x8=512 Bytes
0x00,         // CC3, IC supports ReadMultipleBlocks Command
// End of Compatibility Container

从 IC 文档中阅读更多内容,虽然它确实支持 ReadMultipleBlocks 命令,但它是以 128 字节 block 的形式支持的。这可能是导致我们看到的奇怪行为的原因。

我还是不明白为什么Android可以毫无问题地处理它,而Apple却无法读取它。但是更改设置可以解决 CoreNFC 的问题。

关于ios - 当 TLV 字段使用 3 字节长度格式时,CoreNFC 不会读取,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46535156/

相关文章:

ios - iOS 应用程序警报和通知中的表情符号 - Xcode/Swift

ios - 存储在 SSKeychain 中的 CFUUID 在某些设备中为空

ios - 在 Xcode 中归档 native 应用程序时出错 - 多个命令产生 'libyoga.a'

javax.smartcardio 传输到 NFC USB 读卡器,无需卡

java - 使用低级 NFC 通信方法将 NDEF 数据写入 NTAG216 标签

ios - 如何将 CSV 数据解析为 App UI 的 XCode

android - 读取 NFC 标签的内容

android - 在 Android 中读取多个 NFC 标签。 IsoDep-tag 在屏幕解锁时无法读取

java - 如何使用 Java Android Beam 将消息从 PC 发送到手机?

android - 无法格式化 NdefFormatable NFC 标签