gpt4 book ai didi

ios - 在 iOS 13 中使用 UIImagePickerController 时崩溃

转载 作者:行者123 更新时间:2023-11-29 05:22:59 25 4
gpt4 key购买 nike

它在其他演示中运行良好,但在我的项目中崩溃了。我用谷歌搜索“CAMPreviewViewController”但什么也没找到

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

崩溃

Assertion failure in -[CAMPreviewViewController _updateIndicatorsForMetadataObjectResults:viewType:viewClass:frameCallback:minimumAreaChangeThreshold:minimumAreaFractionChangeThreshold:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/Camera/Camera-3602.9.230/CameraUI/Source/CAMPreviewViewController.m:1152

最佳答案

试试这个

    var imagePicker: UIImagePickerController!

@IBAction func takePhotoAction(_ sender: UIButton) {
imagePicker = UIImagePickerController()
imagePicker.delegate = self
imagePicker.sourceType = .camera
present(imagePicker, animated: true, completion: nil)
}

Add This to class as delegates

UINavigationControllerDelegate, UIImagePickerControllerDelegate

关于ios - 在 iOS 13 中使用 UIImagePickerController 时崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58481517/

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