Unable to change cameraFlashMode for UIImagePickerController iphone 4 custom cameraOverlayView

Question : Why does imagePickerController.cameraFlashMode always return 0 on iphone 4 and return correct values ​​using iphone 5?

I launched my UIImagePickerController and set the camera to FlashMode UIImagePickerControllerCameraFlashModeOn:

imagePickerController = [[UIImagePickerController alloc] init];
imagePickerController.sourceType = UIImagePickerControllerSourceTypeCamera;
imagePickerController.mediaTypes = [NSArray arrayWithObject:@"public.image"];
imagePickerController.cameraCaptureMode = UIImagePickerControllerCameraCaptureModePhoto;
imagePickerController.showsCameraControls = NO;
imagePickerController.cameraFlashMode = UIImagePickerControllerCameraFlashModeOn;
[rest of overlay creation...]

Then, when the flash button of my custom overlay is pressed, this method starts: enter image description here

As you can see in the screenshot below, the value of cameraFlashMode is true in the "representation of variables", but returns 0 using NSLog and imagePickerController.cameraFlashMode

NSLog(@"current cameraFlashMode=%d", imagePickerController.cameraFlashMode); //returns 0 (iphone 4)

log and console debug from iphone4

However, on iphone 5, the value is available without problems:

NSLog(@"current cameraFlashMode=%d", imagePickerController.cameraFlashMode); //returns 1 (iphone 5)
+3
source share

All Articles