When [camera takePicture]
is called before the camera is ready, it spits out this message:
UIImagePickerController: ignoring request to take pictu
If you are using UIImagePickerController, following is the code for video, similar code implies for image as well.
UIImagePickerController *picker;
BOOL cameraIsOn;
Then check for camera device available
if ([UIImagePickerController isCameraDeviceAvailable:[picker cameraDevice]]) {
if (cameraIsOn) {
NSLog(@"stop camera");
[picker stopVideoCapture];
cameraIsOn = FALSE;
}
else {
NSLog(@"start camera");
[picker startVideoCapture];
self.videoTimer = [NSTimer scheduledTimerWithTimeInterval:1 target:self selector:@selector(changeValue) userInfo:nil repeats:YES];
cameraIsOn = TRUE;
}
}