本文介绍了无法使用iOS13读取ePassport的NFC芯片的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
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
and in my 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])
从未被调用.我想念什么?
My problem is that tagReaderSession(_ session: NFCTagReaderSession, didDetect tags: [NFCTag])
is never being called. What am I missing?
推荐答案
我发现我在Info.plist的com.apple.developer.nfc.readersession.iso7816.select-identifiers
条目中添加了00000000000000
的解决方案现在看起来像这样:
I found the solution I added 00000000000000
to the com.apple.developer.nfc.readersession.iso7816.select-identifiers
entry in the Info.plistNow it looks like this:
<key>com.apple.developer.nfc.readersession.iso7816.select-identifiers</key>
<array>
<string>A0000002471001</string>
<string>00000000000000</string>
</array>
这篇关于无法使用iOS13读取ePassport的NFC芯片的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!