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
- Terrain Tree cast Realtime and Baked shadows simultaneously when "Mixed" Light mode and "Subtractive" Baked Illumination is used in Edit mode
- OnPostprocessAllAssets() is not called for a modified Prefab when another Asset is set Dirty in the same callback
- [Android] UIToolkit ClickEvent is fired when the device is rotated
- Compilation errors occur when "uintBitsToFloat(int)" gets used in OpenGLES
- User Reporting does not send reports when Managed Stripping Level is set to Low or higher
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.