gpt4 book ai didi

ios - 带有 UIImagePickerControllerSourceTypeCamera 的 UIImagePickerController 在 ios7 中崩溃 EXC_BAD_ACCESS

转载 作者:行者123 更新时间:2023-11-28 18:10:59 25 4
gpt4 key购买 nike

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

此代码在 ios7 设备上导致 EXC_BAD_ACCESS 崩溃。在 iOS6 上 - 一切正常,UIImagePickerControllerSourceTypePhotoLibrary 工作正常。

最佳答案

使用相机

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

关于ios - 带有 UIImagePickerControllerSourceTypeCamera 的 UIImagePickerController 在 ios7 中崩溃 EXC_BAD_ACCESS,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20163027/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com