@@ -722,6 +722,40 @@ - (void)jsEventOccurredWithBody:(NSData *)body {
722722 }
723723}
724724
725+ /*
726+ Unity overrides orientation behavior and enables all orientations in supportedInterfaceOrientations, regardless of
727+ the values set in the info.plist. It then uses its own internal logic for restricting the Application's views to
728+ the selected orientations. This view controller inherits the behavior of all orientations being allowed so we need
729+ to manually set the supported orientations based on the values in the plist.
730+ If no values are selected for the orientation key in the plist then we will default to super's behavior.
731+ */
732+ - (UIInterfaceOrientationMask)supportedInterfaceOrientations {
733+ NSUInteger orientationMask = 0 ;
734+ NSArray *supportedOrientations = [[NSBundle mainBundle ] objectForInfoDictionaryKey: @" UISupportedInterfaceOrientations" ];
735+ if (!supportedOrientations) {
736+ return [super supportedInterfaceOrientations ];
737+ }
738+
739+ if ([supportedOrientations containsObject: @" UIInterfaceOrientationLandscapeLeft" ]) {
740+ orientationMask += UIInterfaceOrientationMaskLandscapeLeft;
741+ }
742+
743+ if ([supportedOrientations containsObject: @" UIInterfaceOrientationLandscapeRight" ]) {
744+ orientationMask += UIInterfaceOrientationMaskLandscapeRight;
745+ }
746+
747+ if ([supportedOrientations containsObject: @" UIInterfaceOrientationPortrait" ]) {
748+ orientationMask += UIInterfaceOrientationMaskPortrait;
749+ }
750+
751+ if ([supportedOrientations containsObject: @" UIInterfaceOrientationPortraitUpsideDown" ]) {
752+ orientationMask += UIInterfaceOrientationMaskPortraitUpsideDown;
753+ }
754+
755+ return orientationMask;
756+
757+ }
758+
725759/*
726760 Override method for handling orientation change within a view controller on iOS 8 or higher
727761 This specifically handles the resizing and reanimation of a currently showing IAM
0 commit comments