There is no delegate callback that tells you when the camera is ready. I tried this but no luck, still your error:
if ([UIImagePickerController isCameraDeviceAvailable:[picker cameraDevice]]) {
[picker takePicture];
}
else {
NSLog(@"Camera not ready");
}
I called take picture after delay of 1.0, 1.5, 2.0 seconds. My observations:
At 1.0 secs: takes the picture but the full shutter closing is not seen on the screen
At 1.5 secs: shutter closing is seen but very little
At 2.0 secs: loads the camera, shows whats on the screen and then takes the picture.
So you might wanna use something between 1.75 to 2.25. Code i used:
[picker performSelector:@selector(takePicture) withObject:nil afterDelay:2.0];
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…