I'm using Apple's provided example AVCam, but it's somewhat modified for my app's purposes. However, none of the original stuff is really touched except for fixing some other issues. However, when it came to making it work in landscape mode, I've hit a major roadblock.
I have the following code in the correct class that I took from another question on stackoverflow:
-(void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration {
[CATransaction begin];
if (toInterfaceOrientation==UIInterfaceOrientationLandscapeLeft){
captureVideoPreviewLayer.orientation = UIInterfaceOrientationLandscapeLeft;
} else {
captureVideoPreviewLayer.orientation = UIInterfaceOrientationLandscapeLeft;
}
[CATransaction commit];
[super willAnimateRotationToInterfaceOrientation:toInterfaceOrientation duration:duration];
}
-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
[[UIApplication sharedApplication] setStatusBarOrientation:UIInterfaceOrientationLandscapeLeft animated:NO];
return (interfaceOrientation == UIInterfaceOrientationLandscapeLeft);
}
However, it doesn't work. The purpose of this code was to allow for landscape when the phone is moved. Everytime you shift orientation a warning pops up in the console:
WARNING: -[<AVCaptureVideoPreviewLayer: 0x1ed97620> setOrientation:] is deprecated. Please use AVCaptureConnection's -setVideoOrientation:
Not sure what to do to fix this deprecation error, or if the deprecation is what's causing it not to shift into landscape. Help please!