Adding Custom Parameter - Phonegap Build

 ̄綄美尐妖づ 提交于 2019-12-12 16:16:24

问题


Recently Apple has made it mandatory to add declare encryption/cryptography with every build uploaded to Itunesconnect. But since it is not applicable to me since my app doesn't involve in any of those functions said by apple page (Correct me If I am wrong).I would like to apply for exemption from it.

For that I have to add

<key>ITSAppUsesNonExemptEncryption</key><false/>

to info.plist as specified by Ituneconnect manual.

Since my app is built with Phonegap Build I can only add with config file(Would like to know if there are any other way.).

So I try to add it with Config File Element.Like this.

  <config-file platform="ios" parent="ITSAppUsesNonExemptEncryption" mode="add">
       <false />
   </config-file>

But it did no difference.info.plist did not include above property when I try to extract .ipa from phonegap build and check it out. What am I doing wrong. Is there any other way to get around Compliance Laws with phonegap build.

This is the config.xml file:

<widget id="com.example.examples" version="0.0.30.4" xmlns="http://www.w3.org/ns/widgets" xmlns:gap="http://phonegap.com/ns/1.0">
    <name>example</name>
    <description>
    example example
    </description>
    <author email="example.com" href="example.com">
        Nikhil Shetye
    </author>
    <content src="index.html" />
    <preference name="permissions" value="none" />
    <preference name="orientation" value="portrait" />
    <preference name="target-device" value="universal" />
    <preference name="fullscreen" value="true" />
    <preference name="webviewbounce" value="true" />
    <preference name="prerendered-icon" value="true" />
    <preference name="stay-in-webview" value="false" />
    <preference name="ios-statusbarstyle" value="black-opaque" />
    <preference name="detect-data-types" value="true" />
    <preference name="exit-on-suspend" value="false" />
    <preference name="show-splash-screen-spinner" value="true" />
    <preference name="auto-hide-splash-screen" value="true" />
    <preference name="disable-cursor" value="false" />
    <preference name="android-minSdkVersion" value="7" />
    <preference name="android-installLocation" value="auto" />

    <gap:plugin name="org.apache.cordova.battery-status" />
    <gap:plugin name="org.apache.cordova.camera" />
    <gap:plugin name="org.apache.cordova.media-capture" />
    <gap:plugin name="org.apache.cordova.console" />
    <gap:plugin name="org.apache.cordova.contacts" />
    <gap:plugin name="org.apache.cordova.device" />
    <gap:plugin name="org.apache.cordova.device-motion" />
    <gap:plugin name="org.apache.cordova.device-orientation" />
    <gap:plugin name="org.apache.cordova.dialogs" />
    <gap:plugin name="org.apache.cordova.file" />
    <gap:plugin name="org.apache.cordova.file-transfer" />
    <gap:plugin name="org.apache.cordova.geolocation" />
    <gap:plugin name="org.apache.cordova.globalization" />
    <gap:plugin name="org.apache.cordova.inappbrowser" />
    <gap:plugin name="org.apache.cordova.media" />
    <gap:plugin name="org.apache.cordova.network-information" />
    <gap:plugin name="org.apache.cordova.splashscreen" />
    <gap:plugin name="org.apache.cordova.vibration" />
    <gap:plugin name="cordova-custom-config" source="npm" spec="1.2.6" />

    <access origin="*" />
    <plugin name="cordova-plugin-whitelist" version="1" />
    <allow-intent href="http://*/*" />
    <allow-intent href="https://*/*" />
    <allow-intent href="tel:*" />
    <allow-intent href="sms:*" />
    <allow-intent href="mailto:*" />
    <allow-intent href="geo:*" />
    <platform name="ios">
        <allow-intent href="itms:*" />
        <allow-intent href="itms-apps:*" />
        <config-file platform="ios" target="*-Info.plist" parent="ITSAppUsesNonExemptEncryption">
            <false />
        </config-file>
    </platform>
    <engine name="ios" spec="~4.0.1" />
</widget>

And info.plist generated for it:

<?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
    <dict>
        <key>BuildMachineOSBuild</key>
        <string>5665646</string>
        <key>CFBundleDevelopmentRegion</key>
        <string>English</string>
        <key>CFBundleDisplayName</key>
        <string>Example</string>
        <key>CFBundleExecutable</key>
        <string>Example</string>
        <key>CFBundleIconFiles</key>
        <array>
            <string>icon.png</string>
            <string>icon@2x.png</string>
            <string>icon-72.png</string>
            <string>icon-72@2x.png</string>
            <string>icon-50.png</string>
            <string>icon-50@2x.png</string>
            <string>icon-60.png</string>
            <string>icon-60@2x.png</string>
            <string>icon-76.png</string>
            <string>icon-76@2x.png</string>
            <string>icon-40.png</string>
            <string>icon-40@2x.png</string>
            <string>icon-small.png</string>
            <string>icon-small@2x.png</string>
        </array>
        <key>CFBundleIdentifier</key>
        <string>com.examples.example</string>
        <key>CFBundleInfoDictionaryVersion</key>
        <string>6.0</string>
        <key>CFBundleName</key>
        <string>Example</string>
        <key>CFBundlePackageType</key>
        <string>APPL</string>
        <key>CFBundleShortVersionString</key>
        <string>0.0.30.4</string>
        <key>CFBundleSignature</key>
        <string>????</string>
        <key>CFBundleSupportedPlatforms</key>
        <array>
            <string>iPhoneOS</string>
        </array>
        <key>CFBundleURLTypes</key>
        <array/>
        <key>CFBundleVersion</key>
        <string>0.0.30.4</string>
        <key>DTCompiler</key>
        <string>com.apple.compilers.llvm.clang.1_0</string>
        <key>DTPlatformBuild</key>
        <string>13B137</string>
        <key>DTPlatformName</key>
        <string>iphoneos</string>
        <key>DTPlatformVersion</key>
        <string>9.1</string>
        <key>DTSDKBuild</key>
        <string>13B137</string>
        <key>DTSDKName</key>
        <string>iphoneos9.1</string>
        <key>DTXcode</key>
        <string>0710</string>
        <key>DTXcodeBuild</key>
        <string>7B91b</string>
        <key>LSRequiresIPhoneOS</key>
        <true/>
        <key>MinimumOSVersion</key>
        <string>6.0</string>
        <key>NSAppTransportSecurity</key>
        <dict>
            <key>NSAllowsArbitraryLoads</key>
            <true/>
        </dict>
        <key>NSLocationWhenInUseUsageDescription</key>
        <string></string>
        <key>UIDeviceFamily</key>
        <array>
            <integer>1</integer>
            <integer>2</integer>
        </array>
        <key>UILaunchImages</key>
        <array>
            <dict>
                <key>UILaunchImageMinimumOSVersion</key>
                <string>8.0</string>
                <key>UILaunchImageName</key>
                <string>Default</string>
                <key>UILaunchImageOrientation</key>
                <string>Portrait</string>
                <key>UILaunchImageSize</key>
                <string>{320, 480}</string>
            </dict>
            <dict>
                <key>UILaunchImageMinimumOSVersion</key>
                <string>8.0</string>
                <key>UILaunchImageName</key>
                <string>Default</string>
                <key>UILaunchImageOrientation</key>
                <string>Landscape</string>
                <key>UILaunchImageSize</key>
                <string>{320, 480}</string>
            </dict>
            <dict>
                <key>UILaunchImageMinimumOSVersion</key>
                <string>8.0</string>
                <key>UILaunchImageName</key>
                <string>Default-568h</string>
                <key>UILaunchImageOrientation</key>
                <string>Portrait</string>
                <key>UILaunchImageSize</key>
                <string>{320, 568}</string>
            </dict>
            <dict>
                <key>UILaunchImageMinimumOSVersion</key>
                <string>8.0</string>
                <key>UILaunchImageName</key>
                <string>Default-568h</string>
                <key>UILaunchImageOrientation</key>
                <string>Landscape</string>
                <key>UILaunchImageSize</key>
                <string>{320, 568}</string>
            </dict>
            <dict>
                <key>UILaunchImageMinimumOSVersion</key>
                <string>8.0</string>
                <key>UILaunchImageName</key>
                <string>Default-667h</string>
                <key>UILaunchImageOrientation</key>
                <string>Portrait</string>
                <key>UILaunchImageSize</key>
                <string>{375, 667}</string>
            </dict>
            <dict>
                <key>UILaunchImageMinimumOSVersion</key>
                <string>8.0</string>
                <key>UILaunchImageName</key>
                <string>Default-667h</string>
                <key>UILaunchImageOrientation</key>
                <string>Landscape</string>
                <key>UILaunchImageSize</key>
                <string>{375, 667}</string>
            </dict>
            <dict>
                <key>UILaunchImageMinimumOSVersion</key>
                <string>8.0</string>
                <key>UILaunchImageName</key>
                <string>Default-736h</string>
                <key>UILaunchImageOrientation</key>
                <string>Portrait</string>
                <key>UILaunchImageSize</key>
                <string>{414, 736}</string>
            </dict>
            <dict>
                <key>UILaunchImageMinimumOSVersion</key>
                <string>8.0</string>
                <key>UILaunchImageName</key>
                <string>Default-Landscape-736h</string>
                <key>UILaunchImageOrientation</key>
                <string>Landscape</string>
                <key>UILaunchImageSize</key>
                <string>{414, 736}</string>
            </dict>
            <dict>
                <key>UILaunchImageMinimumOSVersion</key>
                <string>8.0</string>
                <key>UILaunchImageName</key>
                <string>Default-Portrait</string>
                <key>UILaunchImageOrientation</key>
                <string>Portrait</string>
                <key>UILaunchImageSize</key>
                <string>{768, 1024}</string>
            </dict>
            <dict>
                <key>UILaunchImageMinimumOSVersion</key>
                <string>8.0</string>
                <key>UILaunchImageName</key>
                <string>Default-Landscape</string>
                <key>UILaunchImageOrientation</key>
                <string>Landscape</string>
                <key>UILaunchImageSize</key>
                <string>{768, 1024}</string>
            </dict>
        </array>
        <key>UIPrerenderedIcon</key>
        <true/>
        <key>UIRequiresFullScreen</key>
        <true/>
        <key>UIStatusBarHidden</key>
        <true/>
        <key>UIStatusBarStyle</key>
        <string>UIStatusBarStyleBlackOpaque</string>
        <key>UISupportedInterfaceOrientations</key>
        <array>
            <string>UIInterfaceOrientationPortrait</string>
            <string>UIInterfaceOrientationPortraitUpsideDown</string>
        </array>
        <key>UISupportedInterfaceOrientations~ipad</key>
        <array>
            <string>UIInterfaceOrientationPortrait</string>
            <string>UIInterfaceOrientationPortraitUpsideDown</string>
        </array>
    </dict>
    </plist>

It just doesn't add the desired property "ITSAppUsesNonExemptEncryption".

Please Help


回答1:


As a PhoneGap Build user in the config.xml try:

<gap:config-file platform="ios" parent="ITSAppUsesNonExemptEncryption" mode="add">
<false/>
</gap:config-file>



回答2:


The point here is that quite in contrary to the documentation http://docs.build.phonegap.com/en_US/configuring_config_file_element.md.html

You must use the gap: namespace such that the config-file tags have an effect. See https://github.com/phonegap/build/issues/512.

I can confirm that the solution twistedm3 posted leads to the tags to be included in the Info.plist like expected.




回答3:


UPDATE

You can't use the cordova-custom-config plugin to define custom config in your config.xml because Phonegap Build doesn't execute plugin hooks :-(

But I believe (not being a Phonegap Build user) that you can use their Config File Elements to do something like:

<config-file platform="ios" parent="CFBundleURLTypes" mode="add">
    <array>
        <dict>
            <key>ITSAppUsesNonExemptEncryption</key>
            <false/>
        </dict>
    </array>
</config-file>

There's a skeleton plugin that applies this to the iOS .plist, but since it's only in a Git repo and not published to NPM, I don't think you can use it with Phonegap Build.



来源:https://stackoverflow.com/questions/35966608/adding-custom-parameter-phonegap-build

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!