views:

830

answers:

3

I've got a simple UIImagePickerController which tries to grab the original selected image:

if ([UIImagePickerController isSourceTypeAvailable:
     UIImagePickerControllerSourceTypePhotoLibrary]) {

    if(defaultpicker == nil){
        defaultpicker = [[UIImagePickerController alloc] init];
    }

    defaultpicker.delegate = self;
    defaultpicker.allowsEditing = NO;
    defaultpicker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
    [self presentModalViewController:defaultpicker animated:YES];
}

Upon selecting:

    - (void)imagePickerController:(UIImagePickerController *)imagepicker didFinishPickingMediaWithInfo:(NSDictionary *)info {

[imagepicker dismissModalViewControllerAnimated:YES];

NSString* key = nil;

for(key in info){
    NSLog(@"Info: %@", key);
}

UIImage *theImage = (UIImage *)[info objectForKey: UIImagePickerControllerOriginalImage];

I'm using 4.0 as the base SDK, and targeting 3.1.3 at the moment. Running the 4.0 simulator, the info collection only contains:

2010-07-07 16:19:33.414 **[516:307] Info: UIImagePickerControllerMediaType

On the device, or running in the iPad 3.2 simulator I get:

2010-07-07 16:19:33.405 **[516:307] Info: UIImagePickerControllerOriginalImage

2010-07-07 16:19:33.414 **[516:307] Info: UIImagePickerControllerMediaType

Am I missing something? This was working fine before I updated to SDK 4.0. I have no warning etc.

Obviously without the original image in the simulator, I can't show or do anything with the selected image as i have no idea what it is.

+1  A: 

Im running on a device running 4.0 (a 3GS) and getitng the same problem. It worked fine before as well. So it is not a simulator error. However for me this only seems to be happening if it is a user created photo album. if selected from the camera roll or taken with the camera it works fine :/.

If i find a solution (working on it now) will post.

Update: It appears to be a bug with apple, since as we both stated, the info dictionary that is returned only contains the key-value pair of the media type even though this value is "public.image" it does not return that image in the UIImagePickerControllerOriginalImage key as it should. I have submitted a bug report Bug ID# 8176175.

Jesse Naugher
update: Apple responded to the bug support.This is a follow up to Bug ID# 8176175. After further investigation it has been determined that this is a known issue, which is currently being investigated by engineering. This issue has been filed in our bug database under the original Bug ID# 8113630. The original bug number being used to track this duplicate issue can be found in the State column, in this format: Duplicate/OrigBug#.Thank you for submitting this bug report. We truly appreciate your assistance in helping us discover and isolate bugs.
Jesse Naugher
Thanks for the update :-)
nullabletype
A: 

Is this fixed on 4.01?

dario
A: 

I was getting this as well, but if you choose this you will get them both(for now it looks a like a workaround):

self.imagePicker.allowsEditing = YES;

James
I just debugged directly on the iPhone itself, which is rather slow and painful but at least I know it behaves correctly on the device!
nullabletype