I am making an app that allows the user to open the photo gallery to change a picture in an image view. Whenever I lock the orientation to landscape mode, to avoid gross constraints and the app overall shoving everything I love off the screen, the photo gallery tries to open in portrait mode. To fix this I made a new class called UIImagePickerController+SupportedOrientations and added
extension UIImagePickerController
{
public override func supportedInterfaceOrientations() -> UIInterfaceOrientationMask {
return .Landscape
}
override public func shouldAutorotate() -> Bool { return false }
}
to hopefully stop this. Now it opens in landscape mode whenever I use the app without locking it, but if I lock it I get the following error
terminating with uncaught exception of type NSException