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
- Cancellation button is not centered and has no padding on the right side in the Background Tasks Window
- UI overlaps in the Project Browser window when resized vertically
- UI Elements overlap in the Search window when Search window is docked and resized horizontally
- ProBuilder Tool item appears twice in the overlay when editing in Vertex/Edge/Face context
- Error “Unable to add Renderer to the Scene after Culling.“ is present when Non-draw instanced Terrain is rendering in a camera within the rendering callbacks of another camera in Built-In Render Pipeline
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.