Search Issue Tracker
By Design
Votes
3
Found in
2017.4.17f1
Issue ID
1124167
Regression
No
[iOS] Crash when calling native UIViewController that changes orientation settings
Steps:
1. Build and run the attached project for iOS ("OrientationCrashExample.zip")
2. In Player: tick a mark on "Lock to current orientation"
3. Press button "Present Modal View Controller [...]"
Result: player crashes.
Reproduced with: 2019.1.0a14, 2018.1.0b3, 2017.4.19f1, 2017.3.0p3, 2017.2.1p2.
Not reproduced with: 2017.1.3f1.
Tested with:
iPad Pro 10.5 (iOS10.3.3) - reproduced
iPhone X (iOS11.3.1) - reproduced
iPhone 7 Plus (iOS11.1.1) - reproduced
iPhone XS Max (iOS12.0) - reproduced
VLNQA00078 Motorola Nexus 6 7.1.1 Snapdragon 805 APQ8084AB Adreno (TM) 420 OpenGL ES 3.2 ZX1G22F7N7 - not reproduced
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- “Remove Unused Overrides” available on not loaded Scene and throws “ArgumentException: The scene is not loaded” warning
- Adaptive Probe Volume occlusion edge is calculated incorrectly when viewing probes near geometry edges
- Sampling a texture using an HLSL file throws shader errors and the code does not compile
- "Graphics.CopyTexture called with null source texture" error when Base Camera of an Overlay Camera is removed with DX11 Graphics API and Compatibility Mode enabled
- WebGL sends wrong value with large numbers when SendMessage function is used
Resolution Note (2018.3.X):
It appears that this exception is normal iOS behavior. Asking to change to an unsupported orientation is not allowed by the OS. In the provided sample it looks like the issue lies in ModalViewControllerLauncher.m (supportedInterfaceOrientations). Since it is not in the engine code there isn't anything that we can do to resolve the issue.
I can think of two solutions.
1. Check that the parent view controller supports the orientation that you need to rotate to before doing so. Something like this:
- (UIInterfaceOrientationMask)supportedInterfaceOrientations
{
if (self.requirePortrait)
{
if ((self.parentViewController.supportedInterfaceOrientations & UIInterfaceOrientationMaskPortrait) ||
(self.parentViewController.supportedInterfaceOrientations & UIInterfaceOrientationMaskPortraitUpsideDown))
return UIInterfaceOrientationMaskPortrait | UIInterfaceOrientationPortraitUpsideDown;
else
return UIInterfaceOrientationMaskAll;
}
else
{
return UIInterfaceOrientationMaskLandscape; // this covers both landscapes
}
}
2. Subclass UIImagePickerController and override supportedInterfaceOrientations. See here for more information on this technique. https://stackoverflow.com/questions/19374237/using-uiimagepickercontroller-in-landscape-orientation
It sounds like that may not always work but is worth trying out.