@@ -655,6 +655,40 @@ - (void)jsEventOccurredWithBody:(NSData *)body {
655655 }
656656}
657657
658+ /*
659+ Unity overrides orientation behavior and enables all orientations in supportedInterfaceOrientations, regardless of
660+ the values set in the info.plist. It then uses its own internal logic for restricting the Application's views to
661+ the selected orientations. This view controller inherits the behavior of all orientations being allowed so we need
662+ to manually set the supported orientations based on the values in the plist.
663+ If no values are selected for the orientation key in the plist then we will default to super's behavior.
664+ */
665+ - (UIInterfaceOrientationMask)supportedInterfaceOrientations {
666+ NSUInteger orientationMask = 0 ;
667+ NSArray *supportedOrientations = [[NSBundle mainBundle ] objectForInfoDictionaryKey: @" UISupportedInterfaceOrientations" ];
668+ if (!supportedOrientations) {
669+ return [super supportedInterfaceOrientations ];
670+ }
671+
672+ if ([supportedOrientations containsObject: @" UIInterfaceOrientationLandscapeLeft" ]) {
673+ orientationMask += UIInterfaceOrientationMaskLandscapeLeft;
674+ }
675+
676+ if ([supportedOrientations containsObject: @" UIInterfaceOrientationLandscapeRight" ]) {
677+ orientationMask += UIInterfaceOrientationMaskLandscapeRight;
678+ }
679+
680+ if ([supportedOrientations containsObject: @" UIInterfaceOrientationPortrait" ]) {
681+ orientationMask += UIInterfaceOrientationMaskPortrait;
682+ }
683+
684+ if ([supportedOrientations containsObject: @" UIInterfaceOrientationPortraitUpsideDown" ]) {
685+ orientationMask += UIInterfaceOrientationMaskPortraitUpsideDown;
686+ }
687+
688+ return orientationMask;
689+
690+ }
691+
658692/*
659693 Override method for handling orientation change within a view controller on iOS 8 or higher
660694 This specifically handles the resizing and reanimation of a currently showing IAM
0 commit comments