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
- UI Overlay Image gets darker on each Camera when multiple Cameras are used
- Assertion failed on expression: 'scriptedImporterClass == SCRIPTING_NULL error when opening the standalone profiler window
- Disabled assets in Import Unity Package window aren't tracked but count as being selected by user
- [Windows] Crash on GetManagerFromContext when video is playing and creating High Definition 3D Projects after FMOD failed to switch back to normal output Error appeared
- GC Alloc produced when adding items to MultiColumnListView with Auto Assign Binding
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.