UIImagePickerController crashes in iPad

spe picture spe · Feb 18, 2011 · Viewed 12.1k times · Source
-(IBAction)selectPressed:(id)sender
{
    UIImagePickerController *picker = [[UIImagePickerController alloc] init];
    picker.delegate = self;
    picker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
    [self presentModalViewController:picker animated:YES];
    [picker release];
}

I am testing this code on iPad and iPhone simulators. In the iPhone simulator (and on real iPhones too) it's ok - gallery appears. But on the iPad simulator (I don't have a device), it crashes. Any ideas why?

Answer

Max picture Max · Feb 18, 2011

Please read the exception messages in the device log:

On iPad, UIImagePickerController must be presented via UIPopoverController