fix(camera): add safe guard for IOS devices without flash #1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
While testing the new Multi Camera support, I noticed that it works flawlessly on Android and iPhone devices. However, when testing on iPad Air 5th Generation and iPad Air M1 (5th Generation), the app would consistently crash.
After investigating, I found that these iPad models do not include hardware flash support, and the current implementation assumes that flash is always available. This causes a crash when the flash UI is initialized.
XCODE - ERROR
This happens due to flashmode being set on device that does not have flash , similar problem has been caught in Flutter Camera Plugin.
check:
AVCam Project Crashes On iPad
[AVCapturePhotoOutput capturePhotoWithSettings:delegate:] flashMode must be set to a value present in the supportedFlashModes array
What this PR does
Why it’s important
This fix is not only relevant to my own use case, but also to any developers who have users working on iPads (or other devices without flash). By adding this safeguard, we ensure that the Multi Camera feature is more robust and usable across the full range of supported devices.