Skip to content

Conversation

@JPilson
Copy link

@JPilson JPilson commented Sep 12, 2025

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

Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '* -[AVCapturePhotoOutput capturePhotoWithSettings:delegate:] flashMode must be set to a value present in the supportedFlashModes array'

This happens due to flashmode being set on device that does not have flash , similar problem has been caught in Flutter Camera Plugin.

check:

What this PR does

  • Adds a safe guard check before initializing flash-related UI elements.
  • Ensures that flashButton and related functionality are only enabled if the device actually supports flash.
  • Prevents crashes on iPads and improves stability across devices without flash hardware.

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.

 Add handling for devices without flash in `toggleFlash`.
@coderabbitai
Copy link

coderabbitai bot commented Sep 12, 2025

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

✨ Finishing touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@shiv19
Copy link
Owner

shiv19 commented Sep 12, 2025

@JPilson Thanks for testing this on iPads. That was the only device I couldn't test this one as I can't test the Camera on the iPad simulator.
I'll merge your PR now. I really appreciate you taking the time to try out my branch.

@shiv19 shiv19 merged commit 8e4e327 into shiv19:feat/multi-camera Sep 12, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants