作者:四川盛地地产顾问有限公司_255 | 来源:互联网 | 2023-01-19 13:26
我找到了解决方案。我在源.xcasset文件夹中而不是在“派生数据”中更改应用程序图标(使用ImageMagick)。所以,这是我的脚本:
#!/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
该脚本在执行之前Copy Bundle Resources
。在执行应用程序图标后,更改了内容,因此在最后一个构建阶段,我需要使用其他运行脚本来还原更改:
if [ "${CONFIGURATION}" != "AppStore" ]; then
IFS=$'\n'
git checkout -- `find "${SRCROOT}/${PRODUCT_NAME}" -name AppIcon.appiconset -type d`
fi
我的构建阶段如下所示:
1> Valentin Sha..:
我找到了解决方案。我在源.xcasset文件夹中而不是在“派生数据”中更改应用程序图标(使用ImageMagick)。所以,这是我的脚本:
#!/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
该脚本在执行之前Copy Bundle Resources
。在执行应用程序图标后,更改了内容,因此在最后一个构建阶段,我需要使用其他运行脚本来还原更改:
if [ "${CONFIGURATION}" != "AppStore" ]; then
IFS=$'\n'
git checkout -- `find "${SRCROOT}/${PRODUCT_NAME}" -name AppIcon.appiconset -type d`
fi
我的构建阶段如下所示: