Swift3 AVFoundation miniFrameDuration属性在swift中不可用

Swift3 AVFoundation miniFrameDuration属性在swift中不可用,swift3,avfoundation,Swift3,Avfoundation,[AVCaptureConnection setVideoMinFrameDuration:] 就像在obj-C中一样,我无法为swift找到相同的版本 为了斯威夫特,我试过了 var device = AVCaptureDevice() device?.activeVideoMinFrameDuration = CMTimeMake(1, 1); 但是在swift中仍然没有运气您正在搜索的方法是来自AVCaptureConnection的videoMinFrameDuration。自

[AVCaptureConnection setVideoMinFrameDuration:] 就像在obj-C中一样,我无法为swift找到相同的版本

为了斯威夫特,我试过了

var device = AVCaptureDevice()
    device?.activeVideoMinFrameDuration = CMTimeMake(1, 1);

但是在swift中仍然没有运气

您正在搜索的方法是来自AVCaptureConnection的
videoMinFrameDuration
。自iOS7以来,此函数已被弃用

顺便说一下,文件上说:

仅当isVideoMinFrameDurationSupported为true时,才能设置此值

您应该检查isVideoMinFrameDurationSupported是否为true

如果要替换该功能,请阅读以下答案:

资料来源: