更改 PhoneGap 应用程序的应用程序切换器/设置图标

Posted

技术标签:

【中文标题】更改 PhoneGap 应用程序的应用程序切换器/设置图标【英文标题】:Change App Switcher/Settings icon for PhoneGap app 【发布时间】:2016-09-14 11:21:39 【问题描述】:

我已经使用 PhoneGap、PhoneGap Build 构建了一个 ios 应用程序,并将其上传到 iTunes Connect 和 Application Loader。当我在 TestFlight 中打开它时,无论我对代码或图像做什么,设置中的应用程序图标以及当您在应用程序切换器上查看它时(双击主页按钮)始终是 PhoneGap 默认机器人(见图)。如果我在 www 目录中搜索 .png,这个图标甚至都不存在!我对如何配置我的 config.xml 进行了无休止的研究,但似乎没有任何改变,而且似乎没有任何确凿的文档可以帮助我。

这是我的配置(省略敏感信息)所有图标的网址都正确解析:

<?xml version="1.0" encoding="UTF-8"?>

<!-- config.xml reference: https://build.phonegap.com/docs/config-xml -->
<widget xmlns     = "http://www.w3.org/ns/widgets"
        xmlns:gap = "http://phonegap.com/ns/1.0"
        id        = "my_id_here"
        version   = "19">

    <gap:config-file platform="ios" parent="CFBundleShortVersionString">
        <string>1.0.0</string>
    </gap:config-file>

    <name>App name here</name>

    <description>
        App description here
    </description>

    <author href="my_url_here" email="my_email_here">
        Author name here
    </author>

    <!-- Define the main entry-point to the application -->
    <content src="index.html" />

    <!-- Customize your app and platform with the preference element. -->
    <platform name="ios">
        <preference name="orientation"                value="portrait" />       <!-- all: default means both landscape and portrait are enabled -->
        <preference name="target-device"              value="handset" />        <!-- all: possible values handset, tablet, or universal -->
        <preference name="fullscreen"                 value="true" />           <!-- all: hides the status bar at the top of the screen -->
        <preference name="webviewbounce"              value="true" />           <!-- ios: control whether the screen 'bounces' when scrolled beyond the top -->
        <preference name="prerendered-icon"           value="true" />           <!-- ios: if icon is prerendered, iOS will not apply it's gloss to the app's icon on the user's home screen -->
        <preference name="stay-in-webview"            value="false" />          <!-- ios: external links should open in the default browser, 'true' would use the webview the app lives in -->
        <preference name="ios-statusbarstyle"         value="default" />    <!-- ios: black-translucent will appear black because the PhoneGap webview doesn't go beneath the status bar -->
        <preference name="detect-data-types"          value="false" />          <!-- ios: controls whether data types (such as phone no. and dates) are automatically turned into links by the system -->
        <preference name="exit-on-suspend"            value="true" />           <!-- ios: if set to true, app will terminate when home button is pressed -->
        <preference name="show-splash-screen-spinner" value="true" />          <!-- ios: if set to false, the spinner won't appear on the splash screen during app loading -->
        <preference name="auto-hide-splash-screen"    value="true" />           <!-- ios: if set to false, the splash screen must be hidden using a javascript API -->
        <preference name="deployment-target"          value="8.0" />
    </platform>

    <!-- Plugins -->
    <!-- Core plugins -->
    <plugin name="cordova-plugin-battery-status"      source="npm" spec="~1.1.1" />
    <plugin name="cordova-plugin-camera"              source="npm" spec="~2.1.1" />
    <plugin name="cordova-plugin-media-capture"       source="npm" spec="~1.2.0" />
    <plugin name="cordova-plugin-console"             source="npm" spec="~1.0.2" />
    <plugin name="cordova-plugin-contacts"            source="npm" spec="~2.0.1" />
    <plugin name="cordova-plugin-device"              source="npm" spec="~1.1.1" />
    <plugin name="cordova-plugin-device-motion"       source="npm" spec="~1.2.0" />
    <plugin name="cordova-plugin-device-orientation"  source="npm" spec="~1.0.2" />
    <plugin name="cordova-plugin-dialogs"             source="npm" spec="~1.2.0" />
    <plugin name="cordova-plugin-file"                source="npm" spec="~4.1.1" />
    <plugin name="cordova-plugin-file-transfer"       source="npm" spec="~1.5.0" />
    <plugin name="cordova-plugin-geolocation"         source="npm" spec="~2.1.0" />
    <plugin name="cordova-plugin-globalization"       source="npm" spec="~1.0.3" />
    <plugin name="cordova-plugin-inappbrowser"        source="npm" spec="~1.3.0" />
    <plugin name="cordova-plugin-media"               source="npm" spec="~2.2.0" />
    <plugin name="cordova-plugin-network-information" source="npm" spec="~1.2.0" />
    <plugin name="cordova-plugin-splashscreen"        source="npm" spec="~3.2.1" />
    <plugin name="cordova-plugin-statusbar"           source="npm" spec="~2.1.2" />
    <plugin name="cordova-plugin-vibration"           source="npm" spec="~2.1.0" />
    <plugin name="cordova-plugin-whitelist"           source="npm" spec="~1.2.1" />
    <plugin name="cordova-plugin-insomnia" />

    <gap:platform name="ios" />

    <!-- Define app icon and splashscreen for each platform. -->
    <icon src="icon.png" gap:platform="ios"  />

    <!-- iPhone / iPod Touch  -->
    <icon src="res/icon/ios/icon-60.png" gap:platform="ios"   />
    <icon src="res/icon/ios/icon-60@2x.png" gap:platform="ios"   />

    <!-- iPhone 6 / 6+ -->
    <icon src="res/icon/ios/icon-60@3x.png" gap:platform="ios"   />

    <icon src="res/icon/ios/ipad-76.png" gap:platform="ios"   />
    <icon src="res/icon/ios/ipad-76@2x.png" gap:platform="ios"   />

    <!-- app switcher & settings THIS IS WHAT I'VE GLEANED FROM WEB BUT IT DOESN'T WORK -->
    <icon src="res/icon/ios/AppIcon29x29.png" gap:platform="ios"   />
    <icon src="res/icon/ios/AppIcon29x29@3x.png" gap:platform="ios"   />

    <!-- iPhone and iPod touch -->
    <gap:splash src="res/screen/ios/Default.png" gap:platform="ios"   />
    <gap:splash src="res/screen/ios/Default@2x.png" gap:platform="ios"   />

    <!-- iPhone 5 / iPod Touch (5th Generation) -->
    <gap:splash src="res/screen/ios/Default-568h.png" gap:platform="ios"   />
    <gap:splash src="res/screen/ios/Default-568h@2x.png" gap:platform="ios"   />

    <!-- iPhone 6 -->
    <gap:splash src="res/screen/ios/Default-667h@2x.png" gap:platform="ios"   />
    <gap:splash src="res/screen/ios/Default-Portrait-736h@3x.png" gap:platform="ios"   />
    <gap:splash src="res/screen/ios/Default-Landscape-736h@3x.png" gap:platform="ios"   />

    <!--
        Define access to external domains.

        <access />            - a blank access tag denies access to all external resources.
        <access origin="*" /> - a wildcard access tag allows access to all external resource.

        Otherwise, you can specify specific domains:
    -->
    <access origin="*" />
    <!--
       <access origin="http://phonegap.com" />                    - allow any secure requests to http://phonegap.com/
       <access origin="http://phonegap.com" subdomains="true" />  - same as above, but including subdomains, such as http://build.phonegap.com/
       <access origin="http://phonegap.com" browserOnly="true" /> - only allows http://phonegap.com to be opened by the child browser.
    -->

    <!-- Added the following intents to support the removal of whitelist code from base cordova to a plugin -->
    <!-- Whitelist configuration. Refer to https://cordova.apache.org/docs/en/edge/guide_appdev_whitelist_index.md.html -->

    <allow-intent href="http://*/*" />
    <allow-intent href="https://*/*" />
    <allow-intent href="tel:*" />
    <allow-intent href="sms:*" />
    <allow-intent href="mailto:*" />
    <allow-intent href="geo:*" />

</widget>

我发现的这篇文章表明它可能是 PhoneGap 构建问题,但底部的链接现在已失效! enter link description here

【问题讨论】:

【参考方案1】:

答案贴在这里:

What must I do to change default Phonegap icon when using the phonegap Build service

<icon src="res/icon.png" />

【讨论】:

以上是关于更改 PhoneGap 应用程序的应用程序切换器/设置图标的主要内容,如果未能解决你的问题,请参考以下文章

Phonegap - 单击图标重新启动应用程序,而不是切换到已经运行的应用程序

phonegap 2.2 方向更改不会调整应用程序大小

在 Android 上为 PhoneGap App 更改应用程序主题(使用 phonegap Build)

Phonegap - Phonegap 到 Utils 更改

PhoneGap Cordova InAppBrowser.open 在 iOS 中切换应用程序之前不会打开链接

无法在 phonegap 应用程序的 iframe 中查看/更改输入字段