我遇到了这个错误,但是不知道如何解决它。
WARNING: -[<AVCaptureVideoPreviewLayer: 0xad482c0> isOrientationSupported] is deprecated. Please use AVCaptureConnection's -isVideoOrientationSupported
然而,当我查看苹果公司的文档时,发现这是一个针对Mac OS的函数,而不是针对iOS的,让我有些困惑。期待得到答案。谢谢。
我遇到了这个错误,但是不知道如何解决它。
WARNING: -[<AVCaptureVideoPreviewLayer: 0xad482c0> isOrientationSupported] is deprecated. Please use AVCaptureConnection's -isVideoOrientationSupported
以下是在 Android 6.0以前版本中同样有效的示例代码:
if ([captureVideoPreviewLayer respondsToSelector:@selector(connection)])
{
if ([captureVideoPreviewLayer.connection isVideoOrientationSupported])
{
[captureVideoPreviewLayer.connection setVideoOrientation:self.interfaceOrientation];
}
}
else
{
// Deprecated in 6.0; here for backward compatibility
if ([captureVideoPreviewLayer isOrientationSupported])
{
[captureVideoPreviewLayer setOrientation:self.interfaceOrientation];
}
}
if ([captureVideoPreviewLayer.connection isVideoOrientationSupported])
{
[captureVideoPreviewLayer.connection setVideoOrientation:AVCaptureVideoOrientationPortrait];
}
根据要求,方向将是纵向或横向。
欢迎编辑和建议。