UIImagePickerControllerDelegate Returns Blank "editingInfo" Dictionary Object
Posted
by Leachy Peachy
on Stack Overflow
See other posts from Stack Overflow
or by Leachy Peachy
Published on 2009-08-25T00:08:08Z
Indexed on
2010/04/09
14:23 UTC
Read the original article
Hit count: 306
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];
}
© Stack Overflow or respective owner