cordova-ios icon indicating copy to clipboard operation
cordova-ios copied to clipboard

Setting interface orientation does not work in version 8.0.0

Open contfedorov opened this issue 2 weeks ago • 0 comments

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-ios 7.1.1

  • It can be reproduced by creating empty Cordova project (cordova create MyApp) and updating config.xml accordingly.

  • Generated XCode project (platforms/ios/App.xcodeproj/project.pbxproj) contains lined related to interface orientation. These lines override Info.plist configuration. It can be changed in UI, but it is not an acceptable solution.

Image

Lines in project template:

https://github.com/apache/cordova-ios/blob/5d98b865a0619ca64d0101dc2b0484ad7294be22/templates/project/App.xcodeproj/project.pbxproj#L444-L445

https://github.com/apache/cordova-ios/blob/5d98b865a0619ca64d0101dc2b0484ad7294be22/templates/project/App.xcodeproj/project.pbxproj#L482-L483

  • It can be overridden by overriding supportedInterfaceOrientations in ViewController.swift, but using config.xml is 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

  • [x] I searched for existing GitHub issues
  • [x] I updated all Cordova tooling to most recent version
  • [x] I included all the necessary information above

contfedorov avatar Dec 10 '25 08:12 contfedorov