Hi there,
I have an iPhone app that calls upon the UIImagePickerController to offer folks a choice between selecting images via the camera or via their photo library on the phone. The problem is that sometimes, (Can't always get it to replicate.), the editingInfo dictionary object that is supposed to be returned by didFinishPickingImage delegate message, comes back blank or (null). Has anyone else seen this before?
I am implementing the UIImagePickerControllerDelegate in my .h file and I am correctly implementing the two delegate methods: didFinishPickingImage and imagePickerControllerDidCancel.
Any help would be greatly appreciated. Thank you in advance!
Here is my code...
my .h file:
@interface AddPhotoController : UIViewController <UIImagePickerControllerDelegate, UINavigationControllerDelegate> {
IBOutlet UIImageView *imageView;
IBOutlet UIButton *snapNewPictureButton;
IBOutlet UIButton *selectFromPhotoLibraryButton;
}
@property (nonatomic, retain) UIImageView *imageView;
@property (nonatomic, retain) UIButton *snapNewPictureButton;
@property (nonatomic, retain) UIButton * selectFromPhotoLibraryButton;
my .m file:
@implementation AddPhotoController
@synthesize imageView, snapNewPictureButton, selectFromPhotoLibraryButton;
- (IBAction)getCameraPicture:(id)sender
{
UIImagePickerController *picker = [[UIImagePickerController alloc] init];
picker.delegate = self;
picker.sourceType = UIImagePickerControllerSourceTypeCamera;
picker.allowsImageEditing = YES;
[self presentModalViewController:picker animated:YES];
[picker release];
}
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingImage:(UIImage *)image editingInfo:(NSDictionary *)editingInfo
{
NSLog(@"Image Meta Info.: %@",editingInfo);
UIImage *selectedImage = image;
imageView.image = selectedImage;
self._havePictureData = YES;
[self.useThisPhotoButton setEnabled:YES];
[picker dismissModalViewControllerAnimated:YES];
}
- (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker
{
[picker dismissModalViewControllerAnimated:YES];
}