Cannot read the NFC chip of the ePassport using iOS13
I found the solution I added 00000000000000
to the com.apple.developer.nfc.readersession.iso7816.select-identifiers
entry in the Info.plist
Now it looks like this:
<key>com.apple.developer.nfc.readersession.iso7816.select-identifiers</key>
<array>
<string>A0000002471001</string>
<string>00000000000000</string>
</array>
Trouble reading eID information with NFC using iOS13
Your func tagReaderSession(_ session: NFCTagReaderSession, didDetect tags: [NFCTag])
implementation looks wrong to me. You are converting an NFCISO7816Tag to an NFCNDEFTag then back to an NFCISO7816Tag.
The implementation should look like this:
func tagReaderSession(_ session: NFCTagReaderSession, didDetect tags: [NFCTag]) {
let tag = tags.first!
nfcTagReaderSession?.connect(to: tag) { (error: Error?) in
if case let .iso7816(iso7816Tag) = tag {
// do your magic with iso7816Tag here
}
}
}
Reading the content of the ePassport/eID NFC chip isn't as straigforward as reading a simple NDEF tag.
The working example provided in Appendix D to Part 11 of the Doc9303 from the ICAO is of great help to understand what needs to be implemented.
For my part I am almost done implementing it in swift and will publish the source code under the MIT license once my app is on the app store.
To do so I included some C/C++ code that was taken from here: https://github.com/UBIC-repo/core/tree/master/PassportReader/Reader
You will probably need to use some bridging to C in order to do the 3DES encryption/decryption and checksum calculations.
EDIT: Someone already posted a working source code here: https://github.com/AndyQ/NFCPassportReader
Missing required entitlement for NFCTagReaderSession
I had the same problem, but it is gone after removing and adding Near Field Communication Tag Reading in Capabilities.
My entitlements file have a little differ:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.developer.associated-domains</key>
<array>
<string>applinks:example.com</string>
</array>
<key>com.apple.developer.nfc.readersession.formats</key>
<array>
<string>NDEF</string>
<string>TAG</string>
</array>
</dict>
</plist>
But I don't think this is it.
Also, you can try to modify Apple example to fit your needs: https://developer.apple.com/documentation/corenfc/building_an_nfc_tag-reader_app
Or just remove .iso18092 from polling options and it will work. I think this standard require specific entitlement.
Related Topics
How to Edit the Uiblureffect Intensity
Changing Color of Button Text and State
With Firebase, Swift Removeobserver(Withhandle Does Not Remove the Observer
What Is the "@Exported" Attribute in Swift
Round Top Corners of a Uiview in Swift
What Is the Role of Avcapturedevicetype.Builtindualcamera
Pass Optional Block or Closure to a Function in Swift
Swift Lazy Subscript Ignores Filter
How to Determine If a Variable Passed in Is Reference Type or Value Type
Why Can't I Change Variables in a Protocol Extension Where Self Is a Class
Using Swift Library in Xamarin