views:

945

answers:

2

Hi there,

In my iPad application, I'm letting the user select an image using the following code:

UIImagePickerController* picker = [[UIImagePickerController alloc] init]; 
picker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary; 
picker.delegate = self; 

UIPopoverController *popover = [[UIPopoverController alloc] initWithContentViewController:picker];
self.popoverController = popover;          
popoverController.delegate = self;
[popoverController presentPopoverFromRect:self.view.frame
                                   inView:self.view
                 permittedArrowDirections:UIPopoverArrowDirectionAny
                                 animated:YES];
[picker release];

(I've set up the class to be both a UIPopoverControllerDelegate and a UIImagePickerControllerDelegate, and I've setup the callbacks for both delegates.)

Now, the weird thing is that if I select an image from the "Saved Photos" photo album, my "imagePickerController: didFinishPickingImage" callback method gets called, and I get an image, and all is well.

But, if I select an image from any of the other albums, my "imagePickerControllerDidCancel" callback gets called - and I don't get back an image.

Any idea? I've searched the web high-and-low...

Thanks, Reuven

A: 

The plot thickens...

When adding:
allowsEditing = YES;

I can still select (and crop/scale) images from the Saved Photos album - but when trying to Use images from other albums, the iPad crashes with the debugger showing:

2010-06-03 08:16:06.759 uPrintMobile[98412:207] * Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '* -[NSCFDictionary setObject:forKey:]: attempt to insert nil value (key: UIImagePickerControllerOriginalImage)'

Still no clue...

Reuven
This of course it not an answer but an update - I simply couldn't find the comment/update button on the original post...
Reuven
Another update: on actual iPad, the code works fine.I "reset" my iPad simulator (which of course meant I no longer have albums and I don't know how to create them) and the simulator no longer crashes.Could it have been something wrong with my images?
Reuven
A: 

So much bugs for image picker in iPad !!

Forrest