Call to TKSmartCard.endSession() can cause crash

Call to endSession() after smartcard was physically removed from device leads to application crash:

terminating with uncaught exception of type NSException
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'bad endSession'

I think you could reproduce this with any smartCard:

        card.beginSession { [unowned self] isStarted, err in
            card.transmit(apdu) { [unowned self] response, err in
                card.endSession() // <- set breakpoint here
            }
        }

steps to reproduce:

- start application
- set the breakpoint
- remove device
- continue
Answered by DTS Engineer in 737610022

Call to TKSmartCard.endSession() can cause crash

It sounds like you’re goal is to report a bug. If so, I recommend that you follow the advice here.

Please post your bug number, just for the record.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Accepted Answer

Call to TKSmartCard.endSession() can cause crash

It sounds like you’re goal is to report a bug. If so, I recommend that you follow the advice here.

Please post your bug number, just for the record.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Call to TKSmartCard.endSession() can cause crash
 
 
Q