0

I have MainViewController in landscapeRight orientation which should present UIImagePickerController with sourceType = .camera:

imagePickerCamera.sourceType = UIImagePickerControllerSourceType.camera
imagePickerCamera.allowsEditing = false
self.present(imagePickerCamera, animated: true, completion: nil)

App crashes and then the error says (only on IPhone X):

'UIApplicationInvalidInterfaceOrientation', reason: 'Supported orientations has no common orientation with the application, and [CAMViewfinderViewController shouldAutorotate] is returning YES'

I have set supported orientation in AppDelegate to .landscapeRight. I've tried to set all orientation in .plist and app delegate and only then show imagePicker, but it didn't resolve the issue.

I saw some solutions like this but it didn't help me too.

I found an workaround, but it's doesn't seems like a good solution. You need to set portrait orientation (or just supportedOrientation through supportedInterfaceOrientationsFor), then present picker and when you're done switch back to landscape if needed.

Also I saw somewhere an article in Apple documentation which says that UIImagePickerController supports only Portrait orientation, but I've been using landscape with the image/camera picker for a long time, so idk.

atereshkov
  • 4,311
  • 1
  • 38
  • 49
  • Most probably you just mess the presentation and dismissal of controllers, for example you are presenting VC on some already dismissing controller. – Marek Staňa Jul 31 '18 at 09:17
  • @MarekStaňa not sure if it's possible with rootViewController – atereshkov Jul 31 '18 at 09:42
  • Same issue I am facing right now, My app is in landscape and mode, when I open a camera , I have to set orientation portrait. On dismiss, I have to set landscape. Which is not a good solution. If you find anything, Kindly update us (Y). – Umair_UAS Jan 29 '19 at 09:45

0 Answers0