I init the UIImagePickerController:
imagePicker = [[UIImagePickerController alloc] init];
imagePicker.delegate = self;
imagePicker.sourceType = UIImagePickerControllerSourceTypeCamera;
imagePicker.cameraDevice = UIImagePickerControllerCameraDeviceFront;
and then use this method [imagePicker takePicture];
and I not get any call to the delegate method:
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
Any idea why?
To use an image picker controller, you must provide a delegate that conforms to the UIImagePickerControllerDelegate protocol.
if it does, verify that the device is capable of picking content from the desired source. Do this calling the isSourceTypeAvailable: class method, providing a constant from the “UIImagePickerControllerSourceType” enum.
Also check 'self' hasn't been released.
You don't mention if you're actually presenting the image picker controller to the user by calling
-presentViewController:animated:completion:
(or the olderpresentViewController:animated:
).Apple's docs don't explicitly say so, but I'm pretty sure the image picker controller needs to be shown on screen in order for
-takePicture
to work, otherwise you would be able to take pictures without the user knowing.