Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

isOrientationSupported is deprecated in IOS

I am getting this error and i have no idea how to fix it..

WARNING: -[<AVCaptureVideoPreviewLayer: 0xad482c0> isOrientationSupported] is deprecated.  Please use AVCaptureConnection's -isVideoOrientationSupported

however when I look at the apples documentation it says that it is a Mac OS function.. not IOS... so I am a bit confused... looking forward get some answers.. Thanks..

like image 797
user1526474 Avatar asked Jul 17 '12 23:07

user1526474


1 Answers

Some sample code which works on pre-6.0 as well:

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];
    }                
}
like image 180
pstoppani Avatar answered Sep 30 '22 07:09

pstoppani