Ionic-cli: "ionic cordova platform add ios" ignores Orientation

Created on 11 Jun 2017  Â·  9Comments  Â·  Source: ionic-team/ionic-cli

Ionic version: (check one with "x")
[ ] 1.x (For Ionic 1.x issues, please use https://github.com/ionic-team/ionic-v1)
[ ] 2.x
[x] 3.x

I'm submitting a ... (check one with "x")
[x] bug report
[ ] feature request
[ ] support request => Please do not submit support requests here, use one of these channels: https://forum.ionicframework.com/ or http://ionicworldwide.herokuapp.com/

Description:
When running the command
ionic cordova platform add ios
with
<preference name="Orientation" value="portrait"/>
set, the command ignores the orientation and modifies the config.xml and adds the following lines:

        <splash src="resources/ios/splash/Default-Landscape-736h.png" width="2208" height="1242"/>
        <splash src="resources/ios/splash/Default-Landscape@2x~ipad.png" width="2048" height="1536"/>
        <splash src="resources/ios/splash/Default-Landscape@~ipadpro.png" width="2732" height="2048"/>
        <splash src="resources/ios/splash/Default-Landscape~ipad.png" width="1024" height="768"/>

"ionic cordova resources ios" does not create the landscape-images - as expected - thus breaking the build

Steps to Reproduce:
Set Orientation to portrait:
<preference name="Orientation" value="portrait"/>
Run command:
ionic cordova platform add ios
ionic cordova build ios

Output:

> cordova build ios
✖ Running command - failed!

[ERROR] Cordova encountered an error.
        You may get more insight by running the Cordova command above directly.

[ERROR] An error occurred while running cordova build ios (exit code 1):

        Error: Source path does not exist: resources/ios/splash/Default-Landscape-736h.png
(node:88211) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: channel closed
(node:88211) DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

My ionic info:

global packages:

    @ionic/cli-utils : 1.3.0
    Cordova CLI      : 6.5.0 
    Ionic CLI        : 3.3.0

local packages:

    @ionic/app-scripts              : 1.3.7
    @ionic/cli-plugin-cordova       : 1.3.0
    @ionic/cli-plugin-ionic-angular : 1.3.0
    Cordova Platforms               : ios 4.3.1
    Ionic Framework                 : ionic-angular 3.3.0

System:

    Node       : v7.9.0
    OS         : macOS Sierra
    Xcode      : Xcode 8.3.3 Build version 8E3004b 
    ios-deploy : 1.9.1 
    ios-sim    : 5.0.13

Other Information:

bug

Most helpful comment

@L96Github The solution is forthcoming, that's why I tagged it as a bug and assigned a milestone. The workaround is to remove the <splash xml entries in your config.xml file as described in the original issue.

All 9 comments

"ionic cordova platform add android" seems to have the same bug. It adds:

        <splash src="resources/android/splash/drawable-land-ldpi-screen.png" density="land-ldpi"/>
        <splash src="resources/android/splash/drawable-land-mdpi-screen.png" density="land-mdpi"/>
        <splash src="resources/android/splash/drawable-land-hdpi-screen.png" density="land-hdpi"/>
        <splash src="resources/android/splash/drawable-land-xhdpi-screen.png" density="land-xhdpi"/>
        <splash src="resources/android/splash/drawable-land-xxhdpi-screen.png" density="land-xxhdpi"/>
        <splash src="resources/android/splash/drawable-land-xxxhdpi-screen.png" density="land-xxxhdpi"/>

Does it work if you run cordova platform add ... directly? If not, this is actually a bug in Cordova, not Ionic as Ionic uses Cordova in the background.

Does it work if you use <preference name="orientation" value="portrait"/> (lower-case O) instead of <preference name="Orientation" value="portrait"/>?

cordova platform add ... does not modify the config.xml

Even with lowercase "orientation" the landscape entries are added.

cordova platform add ... does not modify the config.xml

Ah right, this is Ionic added functionality I guess.

Maybe this is dependent on the resources present? Try running ionic cordova resources and then the command again.

ionic cordova resources does not add the landscape images if the orientation is set to portrait.

Same problem here, any solution?

@L96Github The solution is forthcoming, that's why I tagged it as a bug and assigned a milestone. The workaround is to remove the <splash xml entries in your config.xml file as described in the original issue.

This will be fixed in 3.7, although from the look of it, it may already be working? I may have fixed it a while ago while tinkering. Anyway, it's working for me now with my dev CLI.

Was this page helpful?
0 / 5 - 0 ratings