NFCPassportReader icon indicating copy to clipboard operation
NFCPassportReader copied to clipboard

Retry the card reading session when the "Tag connection lost" issue occurs.

Open LuuNguyen0811 opened this issue 1 year ago • 2 comments

I'm frequently encountering the "Tag connection lost" issue. This problem might be related to the iOS version or the device itself. I have two iPhones: an iPhone 8 with iOS 15 and an iPhone 12 with iOS 15. The iPhone 8 successfully reads 8 out of 10 times, whereas the iPhone 12 only reads successfully 5 out of 10 times, often displaying the "Tag connection lost" error.

When I perform the same task using ReadId Me, I experience a similar issue, but it doesn't throw an error. Instead, it maintains the status and continues the reading session, eventually succeeding (8/10 times in ip12 too).

Is there a way to preserve data and continue the reading session when the Tag connection is lost? Does anyone have a solution for this? ~ see "Tag connection lost": https://forums.developer.apple.com/forums/thread/118499

LuuNguyen0811 avatar Jun 21 '24 08:06 LuuNguyen0811

@LuuNguyen0811 I think it depends on how the library handles reading tags. In this library, it will throw exceptions when something goes wrong https://github.com/AndyQ/NFCPassportReader/blob/89813bafed0490d1dab17e1c2c243e41bebcd455/Sources/NFCPassportReader/PassportReader.swift#L247

So I think we have to retry the whole process.

longpham2310 avatar Jul 12 '24 09:07 longpham2310

Unfortunately, when we get the the tag connection lost, iOS closes the NFC Connection and you have to completely start the connection flow (including detection again). I'm not aware of any feature to just retry and trying to preserve a session is currently not possible.

It should be possible to keep whatever was read though and maybe re-start the session with an partially read passport object and continue.

AndyQ avatar Jan 30 '25 08:01 AndyQ