Skip to content
This repository was archived by the owner on Mar 26, 2025. It is now read-only.

App crashes when I lock orientation to PortraitFlipped #14

Open
Stensan opened this issue May 31, 2018 · 10 comments
Open

App crashes when I lock orientation to PortraitFlipped #14

Stensan opened this issue May 31, 2018 · 10 comments

Comments

@Stensan
Copy link

Stensan commented May 31, 2018

Hi, in my app I need to change to PortraitFlipped at one time. But when I try to do this, the app crashes with this error:
Foundation.MonoTouchException: Objective-C exception thrown. Name: UIApplicationInvalidInterfaceOrientation Reason: Supported orientations has no common orientation with the application, and [Xamarin_Forms_Platform_iOS_PlatformRenderer shouldAutorotate] is returning YES

This is my Info.plist:

<key>UISupportedInterfaceOrientations</key>
<array>
	<string>UIInterfaceOrientationPortrait</string>
	<string>UIInterfaceOrientationPortraitUpsideDown</string>
	<string>UIInterfaceOrientationLandscapeLeft</string>
	<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
	<string>UIInterfaceOrientationPortrait</string>
	<string>UIInterfaceOrientationPortraitUpsideDown</string>
	<string>UIInterfaceOrientationLandscapeLeft</string>
	<string>UIInterfaceOrientationLandscapeRight</string>
</array>

In my AppDelegate I have put this:

[Export("application:supportedInterfaceOrientationsForWindow:")]
public UIInterfaceOrientationMask GetSupportedInterfaceOrientations(UIApplication application, IntPtr forWindow)
{
	return DeviceOrientationImplementation.SupportedInterfaceOrientations;
}

The other orientations are not causing trouble.
I am working with Xamarin.Forms, the device is an iPhone 8 and the crash occurs both on the real device and simulator.

@wcoder
Copy link
Owner

wcoder commented May 31, 2018

Hi @Stensan

Which version of Xamarin.Forms do you use?

@Stensan
Copy link
Author

Stensan commented May 31, 2018

Hi @wcoder
I use the latest stable version 3.0.0.482510

@wcoder
Copy link
Owner

wcoder commented May 31, 2018

Ok, I will try to investigate the issue.

Workaround:
Try to use the latest 2.x version of Xamarin.Forms.

@wcoder
Copy link
Owner

wcoder commented May 31, 2018

@Stensan

Would you please provide me an example of plugin using, when the application crashed (for quickly reproduce)?

@Stensan
Copy link
Author

Stensan commented May 31, 2018

Sure, thanks for helping!

OrientationBug.zip

@Stensan
Copy link
Author

Stensan commented May 31, 2018

I installed older Xamarin.Forms versions (2.5.1, 2.5.0 and 2.4.0) but each time I get the same exception.

@wcoder
Copy link
Owner

wcoder commented May 31, 2018

Oh, yes, you right.

Try version 2.3.5.256-pre6

@Stensan
Copy link
Author

Stensan commented May 31, 2018

So it seems this is indeed a bug in Xamarin.Forms. I'll go and open a bug report there. Thanks again.

@wcoder
Copy link
Owner

wcoder commented May 31, 2018

Currently, I have an idea for this issue (workaround):

@Stensan
Copy link
Author

Stensan commented May 31, 2018

No sorry, this doesn't work. There is no more error now, but page does not rotate to upside down. I think this is really a xamarin bug, because even without plugin the portrait upside down doesn't work as expected when I turn my phone.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants