在iPhone XS的iOS 12.1.2中访问麦克风时应用程序崩溃 [英] Application crashing while accessing microphone in iOS 12.1.2 for iPhone XS

查看:361
本文介绍了在iPhone XS的iOS 12.1.2中访问麦克风时应用程序崩溃的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用麦克风进行视频捕获的iOS应用程序上工作。当我们尝试捕获视频时,它会请求麦克风许可并在此之后立即崩溃。我们收到以下错误:

I am working on iOS application which uses microphone for video capture. When we try to capture video, it asks for microphone permission and crashes immediately after that. We are getting following error:


由于未捕获的异常'NSInvalidArgumentException'而终止应用程序,原因:-[AVCaptureDevice setActiveColorSpace:] 不支持-使用 activeFormat.supportedColorSpaces

我们尝试为AVCaptureDevice搜索此属性。但是,找不到相同的内容。

We have tried searching for this property for AVCaptureDevice. However, not able to find the same.

推荐答案


我们尝试在AVCaptureDevice的此属性中进行搜索。
但是找不到相同的内容。

We have tried searching for this property for AVCaptureDevice. However, not able to find the same.

解决方案:

SupportedColorSpaces 属性确实存在于 AVCaptureDevice.ActiveFormat AVCaptureDevice 的正确实例:

The property SupportedColorSpaces really exist under AVCaptureDevice.ActiveFormat, make sure you get the correct instance of AVCaptureDevice:

要使用它,例如:

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

文档在这里:

AVCaptureDeviceFormat

< a href = https://developer.xamarin.com/api/type/AVFoundation.AVCaptureDevice/#Public_Properties rel = nofollow noreferrer> AVFoundation.AVCaptureDevice

SupportedColorSpaces

这篇关于在iPhone XS的iOS 12.1.2中访问麦克风时应用程序崩溃的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆