在构建阶段,我遵循this tutorial根据配置(调试/登台/分发)修改AppIcons。
我创建了以下运行脚本:
IFS=$'\n'
buildNumber=$(/usr/libexec/PlistBuddy -c "Print CFBundleVersion" "${PROJECT_DIR}/${INFOPLIST_FILE}")
versionNumber=$(/usr/libexec/PlistBuddy -c "Print CFBundleShortVersionString" "${PROJECT_DIR}/${INFOPLIST_FILE}")
PATH=${PATH}:/usr/local/bin
function generateIcon () {
BASE_IMAGE_NAME=$1
TARGET_PATH="${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/${BASE_IMAGE_NAME}"
echo $TARGET_PATH
#echo $SRCROOT
#echo $(find ${SRCROOT} -name "Icon-iPhone-60@3x.png")
BASE_IMAGE_PATH=$(find ${SRCROOT} -name ${BASE_IMAGE_NAME})
WIDTH=$(identify -format %w ${BASE_IMAGE_PATH})
if [ "${CONFIGURATION}" == "EnterpriseStaging" ]; then
convert StagingRibbon.png -resize ${WIDTH}x${WIDTH} resizedRibbon.png
composite resizedRibbon.png - ${TARGET_PATH}
fi
if [ "${CONFIGURATION}" == "EnterpriseProduction" ]; then
convert ProdRibbon.png -resize ${WIDTH}x${WIDTH} resizedRibbon.png
composite resizedRibbon.png - ${TARGET_PATH}
fi
}
generateIcon "Icon-iPhone-60@3x.png"
generateIcon "Icon-iPhone-60@2x.png"
generateIcon "Icon-iPhone-40@3x.png"
generateIcon "Icon-iPhone-40@2x.png"
generateIcon "Icon-iPhone-29@3x.png"
generateIcon "Icon-iPhone-29@2x.png"
generateIcon "Icon-iPhone-20@3x.png"
generateIcon "Icon-iPhone-20@2x.png"
这是控制台输出。
复合:此图像格式''@ error / constitute.c / ReadImage / 554没有解码委托。
复合材料:`/Users/moraleda/Library/Developer/Xcode/DerivedData/CLCarRental-exspsggroqxzgzgtpmazepfnvy/Build/Products/EnterpriseStaging-iphonesimulator/CLCarRental.app/Icon-iPhone-60@3x.png'@错误/复合。 c / CompositeImageCommand / 1627。
我在桌面上用图像测试了这些命令,它们工作得很好。我认为访问模拟器文件夹时遇到问题,但是我真的无法解决...