How to set iOS orientations in cordova config.xml for universal app?

I have a universal app and want only portrait orientation for iPhone and landscape for iPad. I don't believe I can just do,

<preference name="Orientation" value="landscape" />

because I can't see how it would differentiate between phone and tablet. Currently I've got this in the root:

...
<platform name="ios">
    <config-file target="foo-Info.plist" platform="ios" parent="UISupportedInterfaceOrientations">
        <array>
            <string>UIInterfaceOrientationPortrait</string>
            <string>UIInterfaceOrientationPortraitUpsideDown</string>
        </array>
    </config-file>

    <config-file target="foo-Info.plist" platform="ios" parent="UISupportedInterfaceOrientations~ipad">
        <array>
            <string>UIInterfaceOrientationLandscapeLeft</string>
            <string>UIInterfaceOrientationLandscapeRight</string>
        </array>
    </config-file>
...
</platform>
...
  1. Why doesn't this update my app's foo-Info.plist? I have tried cordova build ios and I have tried cordova prepare commands, neither update the plist file.
  2. When should these changes take effect? When I add the ios platform? when I do cordova build ios?
  3. I also need this to work for Android phone and tablets if you know how.

You don't have to hardcode your app name here:

<config-file platform="ios" target="*-Info.plist" parent="UISupportedInterfaceOrientations">

To get it working create hooks/after_prepare/011_update_platform_config.js file, take content from here.

Install some npms:

npm install lodash elementtree plist

ionic run, ionic build and ionic prepare commands should update your project files.

For more information check out this topic

P.S.: Your should have a strong reason to use upside-down orientation on an iPhone otherwise it's a pain for users (hello to iBooks).