AndyQ / NFCPassportReader

NFCPassportReader for iOS 13
MIT License
760 stars 249 forks source link

tagReaderSession:failed to connect to tag - Tag response error / no response #183

Open cyberneid opened 1 year ago

cyberneid commented 1 year ago

Starting from iOS 16, on iPhone 12, 13, and 14, we are experiencing a big issue with NFC. We are using it with Italian electronic identity cards, Azerbaijan electronic identity cards as well as other eid from other countries and passports as well.

With iPhone X, XR, and 7 it works like a charm

With iPhone 12, 13, and 14, the NFC reading starts but after BAC, during the reading of DG2 the NFC stops reading and returns this error:

Reading tag - DG11 Reading tag - DG12 Reading tag - COM Reading tag - DG1 Reading tag - DG2 [CoreNFC] -[NFCTagReaderSession transceive:tagUpdate:error:]:879 Error Domain=NFCError Code=102 "Tag response error / no response" UserInfo={NSLocalizedDescription=Tag response error / no response, NSUnderlyingError=0x2817c0120 {Error Domain=nfcd Code=29 "Tag Error" UserInfo={NSLocalizedDescription=Tag Error, NSUnderlyingError=0x2817c31b0 {Error Domain=com.apple.nfstack Code=20 "No response from tag" UserInfo={NSLocalizedDescription=No response from tag}}}}}

it is not a systematic error. Sometimes it works and the app reads all DGs, but very often we get that error.

We tried everything to understand the issue and to find a solution but with no luck.

Any suggestion?

AndyQ commented 1 year ago

I've seem a couple of reports that some phones/passports are more fussy with iphone NFC location and require a more accurate or closer position to the chip (no idea why), which seemed to start with iOS 16, and can lose connection with the chip on longer data reads. I can't replicate it here though so not really sure what I can do.

VincentLaula commented 1 year ago

I am also looking at similar reports but without having been able to reproduce yet. I am interested in all reports, findings, or detailed test reports. (Note that enabling the iOS NFC wallet profile can provide more detailed and low-level iOS traces.)

I have experienced some frame delay timing violations on some iPhones in the past. Can the issue be related to a specific NFC chip variant in the phone?

Was the issue reported in the Apple Feedback system?

AndyQ commented 1 year ago

I've noticed this happen with my iPhone 15 Pro on one of my test passports. All other passports work fine except this one. However, the same passport works fine with an iPhone 11.

Note - The ReadID also shows the same issues with my iPhone 15 Pro so suspect either a CoreNFC issue of something odd with the NFC Chip! Will be raising a feedback with Apple.

RtifactApps commented 1 year ago

Same here! I have an iPhone 14 pro and I keep getting connection lost on SOD and DG2. But it works fine on my old iPhone 7+ and on the iPhone 11 from my work.

jmecom commented 3 months ago

Hey @AndyQ -- I've seen similar problems on a different project, where NFC performs well on old iPhones, like the 11, but new ones fail.

Did you hear anything back from Apple?

phisakel commented 2 months ago

It fails to read Greek ID cards with the same message

mnive93 commented 1 month ago

I am facing the same issue. It almost fails everytime on iPhone 15 Pro max with the following error. What's the solution for this?

Error Domain=NFCError Code=102 "Tag response error / no response" UserInfo={NSLocalizedDescription=Tag response error / no response, NSUnderlyingError=0x303bd6af0 {Error Domain=nfcd Code=29 "Tag Error" UserInfo={NSLocalizedDescription=Tag Error, NSUnderlyingError=0x303bd6910 {Error Domain=com.apple.nfstack Code=20 "No response from tag" UserInfo={NSLocalizedDescription=No response from tag}}}}}

vguerci commented 1 month ago

Just facing the same behaviour with a brand new iPhone 16 Pro / iOS 18.0.1, but I don't have any issues with an iPhone 14 Pro. That happens on all my documents, ReadID failing similarly on one, but performing better on one of them 🤷

I have reports that some other iPhone 16 Pro & Pro Max are working fine. Sounds like a device-specific issue to me.

AndyQ commented 1 month ago

For info, I'm seeing similar things on my 16 Pro. No ideas at the moment sadly

mnive93 commented 1 month ago

We see that if the Wifi is turned off in these models scanning works as expected. Reference

tastydev commented 1 month ago

We see that if the Wifi is turned off in these models scanning works as expected. Reference

I can confirm it with my iPhone 16 Pro... wtf. The iOS NFC API returns the tagResponseError quite often with wifi turned on. As soon as i turn my WIFI off my success rate is increased drastically! In the worst case it is an hardware issue i.e wifi electromagnetic waves are interfering the nfc field communication... The best case is an software issue inside iOS 18.x.x. I will also contact apple with some statistics + proofs.

vguerci commented 1 month ago

I confirm as well, but turning off wifi isn't enough for me, I need to switch on Airplane mode...

I doubt this is an iOS 18 issue, as this issue is older than it, sounds more like a device-specific issue, like you may be unlucky and get a bad NFC reader in your device, maybe interfering with wifi?

May try to go to the Genius bar and see if I can get and 16 Pro replacement that works, I have a coworker with a 16 Pro max that supposed to work 🤷

@AndyQ Does it fails on all of your test documents or just some?

AndyQ commented 1 month ago

Really annoyingly - today - I haven't managed to get a single fail! all my reads are working.

Was trying to replicate this today so I can update a feedback with a sysdiagnose and pointing to this issue (really annoying as last week I was getting frequent timeouts!).

vguerci commented 1 month ago

Just upgraded my 16 Pro to iOS 18.1 RC, and I can now read my docs. Not completely flawlessly, I am still having some disconnections, having a good document positioning is required... But at least that works while it was systematically failing with 18.0.1.

I now guess this issue is:

OTOH, I'm also seeing "unreliability" issues, i.e. frequent disconnections, narrow read spot, with a 16 Pro and having similar reports from someone with a 15 Pro