-
-
Notifications
You must be signed in to change notification settings - Fork 48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: DispatchQueue for synchronizing the session configuration and start operations #214
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please create your PR against next
and not against main
.
Introduce a serial DispatchQueue for managing AVCaptureSession operations in a FIFO (First In, First Out) sequence. Configuration tasks are encapsulated within a synchronous block to ensure complete setup before proceeding. Following this, startRunning() is scheduled asynchronously, guaranteeing it executes only after the configuration is fully committed. | ||
|
||
This approach not only prevents the NSGenericException by ensuring proper sequence of operations but also maintains high performance and responsiveness of the application. | ||
|
||
Related PR [fix(barcode-scanning): add delay before starting camera session #188](https://github.com/capawesome-team/capacitor-mlkit/pull/188) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Introduce a serial DispatchQueue for managing AVCaptureSession operations in a FIFO (First In, First Out) sequence. Configuration tasks are encapsulated within a synchronous block to ensure complete setup before proceeding. Following this, startRunning() is scheduled asynchronously, guaranteeing it executes only after the configuration is fully committed. | |
This approach not only prevents the NSGenericException by ensuring proper sequence of operations but also maintains high performance and responsiveness of the application. | |
Related PR [fix(barcode-scanning): add delay before starting camera session #188](https://github.com/capawesome-team/capacitor-mlkit/pull/188) | |
fix(ios): use queue for synchronizing the session configuration and start operations of the `scan(...)` method |
} | ||
} | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove this empty line.
This PR addresses synchronization issues reported on an Apple Developer Forum thread, where users encountered NSGenericException due to premature execution of AVCaptureSession.startRunning(). The problem arises from startRunning() being called before the completion of commitConfiguration(), especially noted in iOS 17 and some iOS 16 devices.
To resolve this, we introduce a serial DispatchQueue for managing AVCaptureSession operations in a FIFO (First In, First Out) sequence. Configuration tasks are encapsulated within a synchronous block to ensure complete setup before proceeding. Following this, startRunning() is scheduled asynchronously, guaranteeing it executes only after the configuration is fully committed. This approach not only prevents the NSGenericException by ensuring proper sequence of operations but also maintains high performance and responsiveness of the application.## Pull request checklist
Related PR fix(barcode-scanning): add delay before starting camera session #188
Please check if your PR fulfills the following requirements:
npm run changeset
).