I’m developing an iOS application using CoreNFC and working with ISO7816 tags. My use case involves exchanging APDU commands with a hardware device, but some operations can take more than 20 seconds. From my testing, I see that: The NFC reader session itself lasts about 60 seconds. But once a tag is connected, the connection seems to drop after ~20 seconds, and I receive a “connection lost” / session invalidated error. My questions are: Is this ~20-second connection window a hard limit enforced by iOS? Is there any way to extend this timeout for long-running APDU operations? If not, what’s the recommended design pattern for handling these scenarios? For example, should I split the process into smaller APDU commands and prompt the user to re-tap when the session times out? Any guidance or best practices for handling long NFC exchanges on iOS would be greatly appreciated.
How to handle CoreNFC session timeout when APDU exchange exceeds 20 seconds?
The 20 second limit is a hard limit, and there is no opportunities to extend it.
Furthermore, you may need to plan for a cooldown period between sessions as well.
My recommendation would be to reconsider if NFC is the correct tool for what you are trying to do. A typical NFC transaction takes a few seconds, and even reading complex documents take no longer than approximately 10 seconds. The time limits on the sessions have been determined based on common use cases, and as the 20 seconds limit cannot be extended, and you may have to require a hardware imposed cooldown period between sessions, your users may find this process inconvenient.
But in the end, it is your business to decide if using NFC despite not satisfying your requirements is something to build upon.