3

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 returns unknown, even when initiating device orientation changes with UIDevice.current.beginGeneratingDeviceOrientationNotifications() and UIDevice.current.isGeneratingDeviceOrientationNotifications is returning true

  • Apple has deprecated interfaceOrientation for the UIViewController.

  • 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.

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.

M-P
  • 4,909
  • 3
  • 25
  • 31
  • 1
    Its looks like here solution: https://stackoverflow.com/a/61749704 – Bimawa Nov 29 '20 at 12:29
  • @Bimawa Thanks for the suggestion! Unfortunately, Messages App Extensions don't have a window scene at all from what I can tell. – M-P Dec 25 '20 at 01:08
  • Hmm, maybe this help to you: https://stackoverflow.com/a/37329460/887325 – Bimawa Dec 26 '20 at 14:58

0 Answers0