I was inspired by Eric's idea of adding a custom parameter to the project, but I did not want to run the script every time I built the project.
We know that by default iPhone searches for icon files named "Icon.png". It turns out that the "Icon File" parameter in the project plist is not needed at all if you correctly named your icon. However, if the project does not have a file named "Icon.png", xCode checks the value of the "Icon File" parameter.
I set a user parameter in "Debug" called "Icon_Name" for the custom icon name "DevIcon.png" and "ReleaseIcon.png" for the "Release" configuration. Now the "Icon file" parameter in the project plist can be set to $ {ICON_NAME} and will take the value of any configuration file that we use. Now, in two different configurations, two different icons are used.
Edit:. For several icons (high res, small, ipad, etc.) I made a slightly different approach. The user parameter is now “IconPrepend,” which is “Dev” for debugging and “Release” for the release version. Now I use the "Icon Files" (and not the "Icon File") in the info plist, which takes an array of strings. Each line is added using $ {ICONPREPEND}, so the debug configurations look for "DevIcon.png" or " DevIcon@2x.png " and the release configurations look for "ReleaseIcon.png" or " ReleaseIcon@2x.png ".
source share