Search code examples
ipadios4uipickerviewcontroller

iPad UIImagePicker Problem !


iam trying import an image from photos library but when i press the import button program crashes and received SGIBART !! but my code works fine on iPhone why ?

here is my code :

.h :

@interface CameraViewController : UIViewController <UIImagePickerControllerDelegate ,UINavigationControllerDelegate> {

    UIImagePickerController *ipc;
    UIImageView * image1;

@property (.......................;
}

.m :

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



    image1.image = [[info objectForKey:UIImagePickerControllerOriginalImage]retain];
    [[picker parentViewController]dismissModalViewControllerAnimated:YES];
    [picker release];   

}


- (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker {

    [[picker parentViewController]dismissModalViewControllerAnimated:YES];
    [picker release];


}



        -(IBAction) importImage1 {

    ipc = [[UIImagePickerController alloc]init];
    ipc.delegate = self;
    ipc.sourceType =  UIImagePickerControllerSourceTypePhotoLibrary;
    [self presentModalViewController:ipc animated:YES];
}

Solution

  • On the iPad iOS 3.2 a UIImagePickerController must be presented in a popover, not as a modal view.

    check this out : http://www.cocos2d-iphone.org/forum/topic/6108