【问题标题】:Cannot read the NFC chip of the ePassport using iOS13使用 iOS 13 无法读取 Passport 的 NFC 芯片
【发布时间】:2019-06-09 15:12:13
【问题描述】:
import UIKit
import CoreNFC

class ViewController: UIViewController, NFCTagReaderSessionDelegate {

    var nfcTagReaderSession: NFCTagReaderSession?

    func tagReaderSessionDidBecomeActive(_ session: NFCTagReaderSession) {
        print("Tag reader did become active")
        print("isReady: \(nfcTagReaderSession?.isReady)")
    }

    func tagReaderSession(_ session: NFCTagReaderSession, didInvalidateWithError error: Error) {
        print("\(error)")
    }

    func tagReaderSession(_ session: NFCTagReaderSession, didDetect tags: [NFCTag]) {
        // this part is never called!
        print("got a Tag!")
        print("\(tags)")
    }

    @IBAction func clickedNFC(_ sender: Any) {
        nfcTagReaderSession = NFCTagReaderSession(pollingOption: [.iso14443], delegate: self)

        nfcTagReaderSession?.alertMessage = "Place the device on the innercover of the passport"
        nfcTagReaderSession?.begin()
        print("isReady: \(nfcTagReaderSession?.isReady)")

    }

}

我的权利文件中也有

<key>com.apple.developer.nfc.readersession.formats</key>
<array>
    <string>NDEF</string>
    <string>TAG</string>
</array>

在我的 Info.plist 中

<key>NFCReaderUsageDescription</key>
<string>Read the NFC chip of ePassports</string>
<key>com.apple.developer.nfc.readersession.iso7816.select-identifiers</key>
<array>
    <string>A0000002471001</string>
</array>

我的问题是 tagReaderSession(_ session: NFCTagReaderSession, didDetect tags: [NFCTag]) 永远不会被调用。我错过了什么?

【问题讨论】:

    标签: swift nfc ios13


    【解决方案1】:

    我找到了将00000000000000 添加到Info.plist 中com.apple.developer.nfc.readersession.iso7816.select-identifiers 条目的解决方案 现在看起来像这样:

    <key>com.apple.developer.nfc.readersession.iso7816.select-identifiers</key>
    <array>
        <string>A0000002471001</string>
        <string>00000000000000</string>
    </array>
    

    【讨论】:

    • 嗨,有人知道在哪里可以找到有关此选择标识符的信息吗?
    • 我读到德国/欧盟护照正在使用 iso14443,但我无法让它工作。有人知道它是否适用于新的德国护照?
    • 它应该与新的一起工作,你得到什么错误?
    • 从哪里获取数据传递" NFCISO7816APDU(instructionClass:0, instructionCode:, p1Parameter:, p2Parameter:, data: HERE, expectedResponseLength:)"
    • 好的,但是为什么在 plist 中?它应该在权利中......阅读苹果文档......
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-02-05
    • 2023-03-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多