Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/122.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 由于AVCaptureConnection上的PixelFormat类型不可用,应用程序终止_Ios_Swift_Avcapturesession_Ios Camera - Fatal编程技术网

Ios 由于AVCaptureConnection上的PixelFormat类型不可用,应用程序终止

Ios 由于AVCaptureConnection上的PixelFormat类型不可用,应用程序终止,ios,swift,avcapturesession,ios-camera,Ios,Swift,Avcapturesession,Ios Camera,我试图在AVCaptureConnection上设置像素格式类型,但它终止于所有RGB设置,但适用于kCVPixelFormatType_32BGRA Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[AVCaptureVideoDataOutput setVideoSettings:] Unsupported pixel format type - use -avai

我试图在AVCaptureConnection上设置像素格式类型,但它终止于所有RGB设置,但适用于kCVPixelFormatType_32BGRA

Terminating app due to uncaught exception 'NSInvalidArgumentException', 
reason: '*** -[AVCaptureVideoDataOutput setVideoSettings:] Unsupported 
pixel format type - use -availableVideoCVPixelFormatTypes'
产生此错误的代码如下:

let settings: [AnyHashable: Any] = [kCVPixelBufferPixelFormatTypeKey as AnyHashable: kCVPixelFormatType_30RGB]
output.videoSettings = settings as! [String : Any]
明白了

我查看了该相机上可用的像素格式,发现它只支持三种不同类型的像素格式

420f、BGRA和420v