In order to set the videoOrientation
of an AVCaptureSession
, I need to know the current orientation the user is in (i.e. portrait
, landscapeLeft
, etc.).
Using
UIDevice.current.orientation
always returnsunknown
, even when initiating device orientation changes withUIDevice.current.beginGeneratingDeviceOrientationNotifications()
andUIDevice.current.isGeneratingDeviceOrientationNotifications
is returningtrue
Apple has deprecated
interfaceOrientation
for theUIViewController
.Trying
UIApplication.shared.statusBarOrientation
yields 1 Error and 1 Warning:- Error:
'shared' is unavailable in application extensions for iOS: Use view controller based solutions where appropriate instead.
- Warning:
'statusBarOrientation' was deprecated in iOS 13.0: Use the interfaceOrientation property of the window scene instead.
- Error:
There does not appear to be a window scene at all in Messages App Extensions.
Does anyone know how to detect the orientation from a Messages Extension? Ultimately I'm trying to re-create a camera view in landscape since UIImagePickerController
does not support landscape for the Camera.