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.
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.
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.
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.