[英]iOS11 AppIcon can't change
iOS 11 beta 10 iOS 11 beta 10
I want package application with custom App icon , so I try to replace AppIcon.png files at DerivedData (/Users/XXX/Library/Developer/Xcode/DerivedData/project/Build/Products/Debug-iphoneos/xxx.app) 我想要使用自定义App图标的包应用程序,所以我尝试在DerivedData上替换AppIcon.png文件(/Users/XXX/Library/Developer/Xcode/DerivedData/project/Build/Products/Debug-iphoneos/xxx.app)
It worked at iOS 10, but doesn't work at iOS 11 它适用于iOS 10,但不适用于iOS 11
Can anybody solve it? 有人可以解决吗?
Thanks for advance 谢谢你提前
I have found a solution. 我找到了解决方案。 I change app icons in the source .xcasset folder, not in Derived Data (using ImageMagick).
我在源.xcasset文件夹中更改应用程序图标,而不是在派生数据中(使用ImageMagick)。 So, here is my script:
所以,这是我的脚本:
#!/bin/bash
IFS=$'\n'
BASE_ICONS_DIR=$(find ${SRCROOT}/${PRODUCT_NAME} -name "AppIcon.appiconset")
IFS=$' '
CONTENTS_JSON="${BASE_ICONS_DIR}/Contents.json"
version=`/usr/libexec/PlistBuddy -c "Print CFBundleShortVersionString" "${INFOPLIST_FILE}"`
# The next line adds special suffix, necessary in my project
version="${version/'$(VERSION_SUFFIX)'/$VERSION_SUFFIX}"
function tag() {
export PATH=$PATH:/usr/local/bin:/opt/boxen/homebrew/bin/
ICON_PATH=$1
width=`identify -format %w ${ICON_PATH}`
[ $? -eq 0 ] || exit 1
height=$((width * 30 / 100))
if [ "${CONFIGURATION}" != "AppStore" ]; then
convert -background '#0008' \
-fill white -gravity center \
-size ${width}x${height} \
caption:"${version}" \
"${ICON_PATH}" +swap -gravity south -composite "${ICON_PATH}" || exit 1
fi
}
ICONS=(`grep 'filename' "${CONTENTS_JSON}" | cut -f2 -d: | tr -d ',' | tr -d '\n' | tr -d '"'`)
ICONS_COUNT=${#ICONS[*]}
IFS=$'\n'
for (( i=0; i<ICONS_COUNT; i++ )); do
tag "$BASE_ICONS_DIR/${ICONS[$i]}"
done
This script is executed before Copy Bundle Resources
. 此脚本在
Copy Bundle Resources
之前执行。 After executing app icons are changed, so I need to revert changes with additional Run Script as a last Build Phase: 执行应用程序图标后,我需要更改其他运行脚本作为最后一个构建阶段的更改:
if [ "${CONFIGURATION}" != "AppStore" ]; then
IFS=$'\n'
git checkout -- `find "${SRCROOT}/${PRODUCT_NAME}" -name AppIcon.appiconset -type d`
fi
My Build Phases looks like this: 我的构建阶段看起来像这样:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.