user1180489
user1180489

Reputation: 33

UIImagePickerController with UIImagePickerControllerSourceTypeCamera crash EXC_BAD_ACCESS in ios7

UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init];
imagePicker.delegate = self;
imagePicker.sourceType = UIImagePickerControllerSourceTypeCamera;
imagePicker.allowsEditing = YES;
[self presentViewController:imagePicker animated:YES completion:nil];

This code make crash EXC_BAD_ACCESS on ios7 devices. On iOS6 - all okay, and UIImagePickerControllerSourceTypePhotoLibrary work normal.

Upvotes: 0

Views: 2500

Answers (1)

Bhumeshwer katre
Bhumeshwer katre

Reputation: 4671

To work with camera

if ([UIImagePickerController isSourceTypeAvailable:
     UIImagePickerControllerSourceTypeCamera]) {
    UIImagePickerController* imagePickerController = [[UIImagePickerController alloc] init];
    imagePickerController.delegate = self;
    imagePickerController.sourceType = UIImagePickerControllerSourceTypeCamera;
    imagePickerController.mediaTypes = [NSArray arrayWithObjects:
                                        (NSString *) kUTTypeImage,
                                        (NSString *) kUTTypeMovie, nil];
    [self presentViewController:imagePickerController animated:YES completion:nil];    }

Upvotes: 7

Related Questions