PhoneGap config.xml iOS 应用程序图标问题
Posted
技术标签:
【中文标题】PhoneGap config.xml iOS 应用程序图标问题【英文标题】:PhoneGap config.xml iOS app icon issues 【发布时间】:2016-05-18 13:07:46 【问题描述】:PhoneGap 文档说我可以通过 config.xml 进行设置(三个月前确实如此)。我没有 Apple 机器,因此无法通过 Xcode 设置图标...所以请避免将我引导至需要 Apple osx 命令行的答案,如果您知道,请分享 config.xml 解决方案 - 谢谢
我在 build.phonegap.com 上构建我的应用
构建 phonegap 的“控制面板”有我的应用程序图标 应用程序图标出现在 android 上,但不在 ios 上。 我的 iOS 安装只显示了一个带圆角的黑色正方形 角落。三个月前构建的应用程序图标在 Android 和 Apple 上都很好。
我有一个平面目录结构。我的 index.html(我的主要 jquery 移动应用程序代码)、config.xml 和 icon.png 在同一目录中。
谁能告诉我哪里出错了?我的 config.xml 如下所示以供参考...(谢谢)
<!-- 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 = "com.myapp.app16"
version = "16.5.11">
<preference name="permissions" value="none"/>
<!-- name, descriptiona and author tags omitted from here on purpose -->
<preference name="orientation" value="default" /> <!-- all: default means both landscape and portrait are enabled -->
<preference name="target-device" value="universal" /> <!-- 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="black-opaque" /> <!-- ios: black-translucent will appear black because the PhoneGap webview doesn't go beneath the status bar -->
<preference name="detect-data-types" value="true" /> <!-- 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="false" /> <!-- 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="disable-cursor" value="false" /> <!-- blackberry: prevents a mouse-icon/cursor from being displayed on the app -->
<preference name="android-installLocation" value="internalOnly" /> <!-- android: app install location. 'auto' will choose. 'internalOnly' is device memory. 'preferExternal' is SDCard. -->
<preference name="StatusBarOverlaysWebView" value="false" />
<preference name="FadeSplashScreen" value="false"/>
<plugin name="cordova-plugin-whitelist" spec="1.2.2" />
<plugin name="org.apache.cordova.device-orientation" spec="1.0.3" />
<plugin name="org.apache.cordova.geolocation" spec="2.2.0" />
<plugin name="org.apache.cordova.network-information" spec="1.2.1" />
<plugin name="org.apache.cordova.splashscreen" spec="3.2.2" />
<plugin name="org.apache.cordova.statusbar" spec="2.1.3" />
<gap:config-file platform="ios" parent="CFBundleShortVersionString">
<string>100</string>
</gap:config-file>
<access origin="*"/>
<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="android">
<allow-intent href="market:*" />
<icon src="icon.png" />
</platform>
<platform name="ios">
<allow-intent href="itms:*" />
<allow-intent href="itms-apps:*" />
<icon src="icon.png" /> <!-- Default icon -->
</platform>
</widget>
【问题讨论】:
【参考方案1】:我相信您实际上需要添加苹果为每个设备使用的每个不同的图标大小。
这是我的实际 config.xml,其中有我的 android 和 ios 图标。 请注意,我的图标位于以下文件夹中:res/icon/ios 和 res/icon/android
<!-- iOS 8.0+ -->
<!-- iPhone 6 Plus -->
<!-- <icon src="res/icon/ios/icon-60@3x.png" /> -->
<!-- iOS 7.0+ -->
<!-- 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" />
<!-- iPad -->
<icon src="res/icon/ios/Icon-76.png" gap:platform="ios" />
<icon src="res/icon/ios/Icon-76@2x.png" gap:platform="ios" />
<!-- iOS 6.1 -->
<!-- Spotlight Icon -->
<icon src="res/icon/ios/Icon-40.png" gap:platform="ios" />
<icon src="res/icon/ios/Icon-40@2x.png" gap:platform="ios" />
<!-- iPhone / iPod Touch -->
<icon src="res/icon/ios/Icon.png" gap:platform="ios" />
<icon src="res/icon/ios/Icon@2x.png" gap:platform="ios" />
<!-- iPad -->
<icon src="res/icon/ios/Icon-72.png" gap:platform="ios" />
<icon src="res/icon/ios/Icon-72@2x.png" gap:platform="ios" />
<!-- iPhone Spotlight and Settings Icon -->
<icon src="res/icon/ios/Icon-Small.png" gap:platform="ios" />
<icon src="res/icon/ios/Icon-Small@2x.png" gap:platform="ios" />
<!-- iPad Spotlight and Settings Icon -->
<icon src="res/icon/ios/Icon-50.png" gap:platform="ios" />
<icon src="res/icon/ios/Icon-50@2x.png" gap:platform="ios" />
<!-- Android Icons -->
<icon src="res/icon/android/ldpi.png" gap:platform="android" gap:qualifier="ldpi" />
<icon src="res/icon/android/mdpi.png" gap:platform="android" gap:qualifier="mdpi" />
<icon src="res/icon/android/hdpi.png" gap:platform="android" gap:qualifier="hdpi" />
<icon src="res/icon/android/xhdpi.png" gap:platform="android" gap:qualifier="xhdpi" />
【讨论】:
我的理解是 recommended 解决方案是将平台特定设置放在<platform name="android"></platform>
为例。以上是关于PhoneGap config.xml iOS 应用程序图标问题的主要内容,如果未能解决你的问题,请参考以下文章
PhoneGap:修改 config.xml 以将属性添加到 Info.plist ion iOS
Cordova/Phonegap / iOS:错误:找不到插件“Plugin01”,或者不是 CDVP 插件。检查 config.xml 中的插件映射
如何使用 Phonegap 2.9 在 config.xml 中声明插件
Apache cordova / phonegap 如何从 config.xml 启用功能