I have a button that is supposed to create a popover with a UIImagePickerController, instead it crashes. I'm not using ARC, and I have looked through many other entries and no others helped. I'm not prematurely releasing anything. Does anyone have a fix?
-(void)pickImageAction {
if ([popoverController isPopoverVisible]) {
[popoverController dismissPopoverAnimated:YES];
[popoverController release];
} else {
if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypePhotoLibrary]) {
picker = [[UIImagePickerController alloc] init];
picker.delegate = self;
picker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
popoverController = [[UIPopoverController alloc] initWithContentViewController:picker];
popoverController.delegate = self;
//Crashes here
[popoverController presentPopoverFromRect:CGRectMake(300, 300, 320, 480) inView:self.view permittedArrowDirections:UIPopoverArrowDirectionLeft animated:YES];
}
}
}
-(IBAction)buttonClicked {
[self pickImageAction];
}