Setting UIPrerenderedIcon from a configuration file in Xcode
-
30-06-2021 - |
Domanda
It seems I am not able to set UIPrerenderedIcon
in my Info.plist
, because it is ignored as of iPhone OS 2.1. You can't provide a String
value of YES
, this is no longer supported.
Is there any other way to do this without necessarly creating a separate Info.plist (e.g., using a pre–build run script)?
Soluzione
I figured this out. You will have to add a "Run Script" build phase, before "Compile Sources":
#!/usr/bin/env sh
set -o errexit set -o nounset
/usr/libexec/PlistBuddy -c "Set UIPrerenderedIcon ${YOUR_CONFIG_KEY}" "${PROJECT_DIR}/*-Info.plist"
Altri suggerimenti
If you want to set value dynamically using command from shell script or terminal, you can do that as below:
/usr/libexec/PlistBuddy -c "Set :UIPrerenderedIcon YES" YOUR_PLIST_FILE_PATH
/usr/libexec/PlistBuddy -c "Set :CFBundleIcons:CFBundlePrimaryIcon:UIPrerenderedIcon YES" YOUR_PLIST_FILE_PATH
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow