I have iPhone application which overlays the camera with custom view. I have a button to switch between camera flash mode, this is the code
switch ([self.imagePi
Okay, so I researched this in great detail, and stumbled upon this helpful article online:
http://www.c2itconsulting.com/2013/10/ios-flash-setting-on-camera-picker-only-available-after-view-is-displayed/
I took their advice, and now I set the flash setting just before the user takes the picture. Instead of checking to see what the camera's current flash setting is, all I do is check my flash button's titleLabel text to see what the user wants as their flash setting:
Here is the code I came up with, which solves the problem perfectly for me now. I hope this helps out all of you with this same problem that didn't exist on iOS 7.0, but now does on iOS 7.1.
#define deviceHasCameraFlash [UIImagePickerController isFlashAvailableForCameraDevice:UIImagePickerControllerCameraDeviceRear]
- (void)capturePhoto
{
if (self.cameraDevice != UIImagePickerControllerCameraDeviceFront && deviceHasCameraFlash)
{
if ([self.flashButton.titleLabel.text isEqualToString:@"Auto"])
{
self.cameraFlashMode = UIImagePickerControllerCameraFlashModeAuto;
}
else if ([self.flashButton.titleLabel.text isEqualToString:@"Off"])
{
self.cameraFlashMode = UIImagePickerControllerCameraFlashModeOff;
}
else if ([self.flashButton.titleLabel.text isEqualToString:@"On"])
{
self.cameraFlashMode = UIImagePickerControllerCameraFlashModeOn;
}
}
[self takePicture];
}