AndyQ / NFCPassportReader

NFCPassportReader for iOS 13
MIT License
738 stars 239 forks source link

Cancelling reading session does not stop reading #141

Closed markus-mohemian closed 2 years ago

markus-mohemian commented 2 years ago

I noticed that the reader session is continuing even though the user actively presses the cancel button on the action sheet after the scan has started. This leads to unexpected behaviour as the completion handler is called multiple times, triggering success and error cases.

The error is easily reproducable in the Example app. I simply put 2 breakpoints in MainView.

Screenshot 2022-05-20 at 12 56 35

When the user presses the cancel button during the reading process the else branch is correctly invoked and the error message displayed. The problem is that it stops not there. The scan continues in background and after a little also the main branch of the if statement gets executed.

This is unintended behaviour as the user actively cancelled the session.

AndyQ commented 2 years ago

Merged - thanks!