[ 
https://issues.apache.org/jira/browse/CB-9703?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15026662#comment-15026662
 ] 

napcat commented on CB-9703:
----------------------------

I have a plugin in my app just to write some settings on plist. Some of that 
settings are the orientations for iphone and ipad.
Unfortunately it seems there's a bug on cordova that remove the orientations 
after a build or run command.

This solution seems a good one.

{code:xml}
    <platform name="ios">
    <config-file target="*-Info.plist" parent="NSAppTransportSecurity">
      <dict>
        <key>NSAllowsArbitraryLoads</key>
        <true/>
      </dict>
    </config-file>

    <config-file target="*-Info.plist" parent="UIStatusBarHidden">
        <true/>
    </config-file>

    <config-file target="*-Info.plist" 
parent="UIViewControllerBasedStatusBarAppearance">
        <false/>
    </config-file>

    <config-file target="*-Info.plist" 
parent="UISupportedInterfaceOrientations">
        <array>
            <string>UIInterfaceOrientationPortrait</string>
            <string>UIInterfaceOrientationPortraitUpsideDown</string>
        </array>
</config-file>

<config-file target="*-Info.plist" 
parent="UISupportedInterfaceOrientations~ipad">
        <array>
            <string>UIInterfaceOrientationPortrait</string>
            <string>UIInterfaceOrientationPortraitUpsideDown</string>
            <string>UIInterfaceOrientationLandscapeLeft</string>
            <string>UIInterfaceOrientationLandscapeRight</string>
        </array>
</config-file>

</platform>
{code}

{code:javascript}
    cordova platform add ios
{code}
the plugin is added and the plist is successfully written with the correct 
orientations and the other settings.

{code:javascript}
   cordova build ios
{code}
the plugin adds successfully the other settings but orientations are delete/ 
erased from plist.

{code:javascript}
   cordova run ios
{code}
the plugin adds successfully the other settings but orientations are delete/ 
erased from plist.

I made a simple project for testing purpose.
The project has some hooks that installs plugins (from npm and a local plugin 
that contains the plugin.xml with the above settings).
On a platform add plugin should be able to add all the settings in plugin.xml 
to the plist file.
On a build or run command, the orientations settings will be 
ignored/overwritten probably by cordova ignoring the change done by plugin.xml.

Testing project: 
https://drive.google.com/file/d/0B68ZTUFuahZ2NURnWGR5NzJ6OU0/view


> iPad orientations can no longer differ from iPhone
> --------------------------------------------------
>
>                 Key: CB-9703
>                 URL: https://issues.apache.org/jira/browse/CB-9703
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: CordovaLib
>    Affects Versions: 5.0.1, 5.1.2, 5.2.0, 5.1.1, 5.3.2
>         Environment: iOS
>            Reporter: Christoph Neumann
>
> The change introduced in 93ab6b61 means that iPhone and iPad orientation 
> values will always be the same. Unfortunately, a universal iOS project 
> defaults to a portrait orientation for iPhone and all orientations for iPad. 
> Because the Cordova "default" for Orientation in config.xml clears all 
> orientation settings, there is no way to get a standard behavior of having 
> separate defaults for iPhone and iPad.
> Some ideas:
> 1. Make "default" actually match what Apple uses as default because clearing 
> out all the flags is *not* truly default behavior.
>   <preference name="Orientation" value="default" />
> 2. Add a platform-specific preference for iPad.
>   <platform name="ios">
>     <preference name="Orientation~iphone" value="portrait" />
>     <preference name="Orientation~ipad" value="all" />
>   </platform>



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to