添加自定义参数 - Phonegap Build

时间:2016-03-13 04:47:45

标签: ios cordova itunesconnect phonegap-build

最近Apple已强制要求在上传到Itunesconnect的每个版本中添加声明加密/加密。 但由于它不适用于我,因为我的应用程序并不涉及苹果页面所述的任何功能(纠正我,如果我错了)。我想申请豁免。

为此,我必须添加

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

到itu​​neconnect手册指定的info.plist。

由于我的应用程序是使用Phonegap Build构建的,因此我只能添加配置文件(想知道是否还有其他方法。)。

所以我尝试用Config File Element添加它。就像这样。

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

但它没有区别。当我尝试从phonegap构建中提取.ipa并检查出来时,info.plist没有包含上述属性。 我究竟做错了什么。 有没有其他方法可以通过phonegap构建来解决合规性法律问题。

这是config.xml文件:

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

为它生成了info.plist:

<?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>

它只是没有添加所需的属性&#34; ITSAppUsesNonExemptEncryption&#34;。

请帮助

3 个答案:

答案 0 :(得分:1)

作为config.xml中的PhoneGap Build用户,请尝试:

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

答案 1 :(得分:1)

这里的观点与文档http://docs.build.phonegap.com/en_US/configuring_config_file_element.md.html

完全相反

必须使用 gap:命名空间,以便 config-file 标记生效。请参阅https://github.com/phonegap/build/issues/512

我可以确认twistedm3发布的解决方案会导致标签包含在 Info.plist 中,就像预期一样。

答案 2 :(得分:0)

<强>更新

无法使用cordova-custom-config插件在config.xml中定义自定义配置,因为Phonegap Build doesn't execute plugin hooks: - (

但我相信(不是Phonegap Build用户)你可以使用他们的Config File Elements来做类似的事情:

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

有一个skeleton plugin将其应用于iOS .plist,但由于它只在Git仓库中发布并且没有发布到NPM,我认为你不能将它用于Phonegap Build。