简体   繁体   English

在iPhone XS的iOS 12.1.2中访问麦克风时应用程序崩溃

[英]Application crashing while accessing microphone in iOS 12.1.2 for iPhone XS

I am working on iOS application which uses microphone for video capture. 我正在使用麦克风进行视频捕获的iOS应用程序上工作。 When we try to capture video, it asks for microphone permission and crashes immediately after that. 当我们尝试捕获视频时,它会请求麦克风许可并在此之后立即崩溃。 We are getting following error: 我们收到以下错误:

"Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: -[AVCaptureDevice setActiveColorSpace:] Not supported - use activeFormat.supportedColorSpaces " “由于未捕获的异常'NSInvalidArgumentException'而终止应用程序,原因: -[AVCaptureDevice setActiveColorSpace:]不支持-使用activeFormat.supportedColorSpaces

We have tried searching for this property for AVCaptureDevice. 我们尝试为AVCaptureDevice搜索此属性。 However, not able to find the same. 但是,找不到相同的东西。

We have tried searching for this property for AVCaptureDevice. 我们尝试为AVCaptureDevice搜索此属性。 However, not able to find the same. 但是,找不到相同的东西。

Solution: 解:

The property SupportedColorSpaces really exist under AVCaptureDevice.ActiveFormat , make sure you get the correct instance of AVCaptureDevice : 属性SupportedColorSpaces实际上存在于AVCaptureDevice.ActiveFormat下,请确保获得正确的AVCaptureDevice实例:

To use it, for example: 要使用它,例如:

 var videoDevs = AVCaptureDevice.DevicesWithMediaType(AVMediaType.Video);
 var device = videoDevs[0];
 NSNumber[] arr = device.ActiveFormat.SupportedColorSpaces;

Document is here: 文件在这里:

AVCaptureDeviceFormat AVCaptureDeviceFormat

AVFoundation.AVCaptureDevice AVFoundation.AVCaptureDevice

SupportedColorSpaces 支持的色彩空间

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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