Reputation: 2633
I am having a strange problem on some devices UIImagePickerController not firing delegate method didFinishPickingImage or didFinishPickingMediaWithInfo.
I have tested the app on iphone 4 iOS 4.1, iPod 4g and iphone 4.3 application is working properly and the delegate methods are working fine.
But on some devices in which iphone 3gs iOS 4.1 and iphone 4 iOS 4.3 these events are not triggering.
Device play the sound of taking picture but then shows the image to edit it when we press USE button the camera just open again.
I also tried to disable the edit mode of image after taking picture of camera but was not helpful.
Can anyone help me why is it happening?
Here is the code I am using:
-(void)startCamera
{
picker = [[UIImagePickerController alloc] init];
picker.allowsEditing = YES;
picker.delegate = self;
picker.sourceType = UIImagePickerControllerSourceTypeCamera;
picker.showsCameraControls = YES;
[self presentModalViewController: picker animated: YES];
[picker release];
}
// IOS 4
//- (void) imagePickerController: (UIImagePickerController*) pickerController didFinishPickingMediaWithInfo: (NSDictionary*) info
// IOS 3
- (void)imagePickerController:(UIImagePickerController *)pickerView didFinishPickingImage:(UIImage *)image editingInfo:(NSDictionary *)editingInfo
{
btnCamera.enabled = YES;
hasTakenImage = YES;
btnRetake.hidden = NO;
btnUpload.hidden = NO;
// imgItem.image = [info objectForKey: UIImagePickerControllerOriginalImage];
imgItem.image = image;
// ADD: dismiss the controller (NB dismiss from the *reader*!)
[pickerView dismissModalViewControllerAnimated: YES];
[self dismissModalViewControllerAnimated: YES];
}
Many Thanks
Upvotes: 1
Views: 3086
Reputation: 71
I hope You are doing
@interface CameraOverlay1 : UIViewController < UIImagePickerControllerDelegate,UINavigationControllerDelegate>
in your header file ....
Upvotes: -2