UIImagePickerController photos shutter not opening

67 views Asked by At

i am developing iPad app which supports Landscape only

What i want to do is, i want to open photos library on button click. Here is my code snippet,

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

when i wrote this it doesn't open photos library :( I don't know where i am doing mistake

Please help and thanks in adavance.

1

There are 1 answers

1
ggg_1120 On

Try this:

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

if([[[UIDevice currentDevice] systemVersion] floatValue]>=8.0)
{
    [[NSOperationQueue mainQueue] addOperationWithBlock:^{
        [self presentViewController:picker animated:NO completion:nil];
    }];
}else{
    [self presentViewController:picker animated:YES completion:nil];
}