Search code examples
ioslandscapemonogame

iOS Landscape orientation issue for MonoGame


Used Xamarin 4.0.10 and last version MonoGame for iOS on Mac OS X. I have a problem with Landscape orientation.

MonoTouch.Foundation.MonoTouchException: Objective-C exception thrown. Name: UIApplicationInvalidInterfaceOrientation Reason: Supported orientations has no common orientation with the application, and shouldAutorotate is returning YES

If I add Portait orientation everything is fine. But I need only Landscape orientation.

graphics = new GraphicsDeviceManager(this);
graphics.PreferredBackBufferHeight = 640;
graphics.PreferredBackBufferWidth = 960;
graphics.SupportedOrientations = DisplayOrientation.LandscapeLeft | DisplayOrientation.LandscapeRight;
graphics.ApplyChanges ();
Content.RootDirectory = "Content";
graphics.IsFullScreen = true;

This problem is appears after start constructor Game1.cs on the method game.Run()


Solution

  • Open Info.plist in Xamarin Studio and check 'Landscape Left' and 'Landscape Right' orientation in 'Supported Device Orientations'.