isOrientationSupported在IOS中已弃用

use*_*474 8 iphone objective-c ios

我收到此错误,我不知道如何解决它..

WARNING: -[<AVCaptureVideoPreviewLayer: 0xad482c0> isOrientationSupported] is deprecated.  Please use AVCaptureConnection's -isVideoOrientationSupported
Run Code Online (Sandbox Code Playgroud)

然而,当我看到苹果文档时,它说它是Mac OS功能..而不是IOS ......所以我有点困惑...期待得到一些答案..谢谢..

pst*_*ani 26

一些示例代码也适用于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];
    }                
}
Run Code Online (Sandbox Code Playgroud)


La *_*bla 3

AVCaptureConnection也可在此处用于 iOS 。您可能查看了错误的文档。