NFCPassportReader
NFCPassportReader copied to clipboard
Retry the card reading session when the "Tag connection lost" issue occurs.
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 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.
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.