简体   繁体   中英

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.

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];    }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM