-
Notifications
You must be signed in to change notification settings - Fork 997
Description
Bug Report
Problem
I need to set device interface orientation to be the following:
- iPhones: portrait only
- iPads: landscape only
I add the following to config.xml in order to update Info.plist:
<platform name="ios">
<config-file target="*-Info.plist" parent="UISupportedInterfaceOrientations">
<array>
<string>UIInterfaceOrientationPortrait</string>
</array>
</config-file>
<config-file target="*-Info.plist" parent="UISupportedInterfaceOrientations~ipad">
<array>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
</config-file>
</platform>App-Info.plist is generated correctly, interface-related options are included. Nevertheless, UI rotates according to emulator rotation.
What is expected to happen?
App orientation is fixed according to my requirements: portrait only for phones, landscape only for tablets.
What does actually happen?
App orientation does not depend on config.xml settings.
Information
-
It used to work in
cordova-ios7.1.1 -
It can be reproduced by creating empty Cordova project (
cordova create MyApp) and updatingconfig.xmlaccordingly. -
Generated XCode project (
platforms/ios/App.xcodeproj/project.pbxproj) contains lined related to interface orientation. These lines overrideInfo.plistconfiguration. It can be changed in UI, but it is not an acceptable solution.
Lines in project template:
cordova-ios/templates/project/App.xcodeproj/project.pbxproj
Lines 444 to 445 in 5d98b86
| INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; | |
| INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; |
cordova-ios/templates/project/App.xcodeproj/project.pbxproj
Lines 482 to 483 in 5d98b86
| INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; | |
| INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; |
- It can be overridden by overriding
supportedInterfaceOrientationsinViewController.swift, but usingconfig.xmlis preferable
Command or Code
Environment, Platform, Device
macOS 15.7.2
iPhone simulator w/ iOS 17.2, 18.4
Version information
Cordova CLI 13.0.0
cordova-ios 8.0.0
no plugins
XCode 16.3
Checklist
- I searched for existing GitHub issues
- I updated all Cordova tooling to most recent version
- I included all the necessary information above