Reputation: 9457
Right now I have a regular iphone app with unique springboard icon and splash screens. Now I want to create basically the same app with minor changes - and this app will have a different name, different springboard icon and different splash screens. So basically what I did now was to duplicate the original build target - but how do I add another icon.png to my project and tell XCode to use the relevant icon for each build? And what about the splash screens?
Upvotes: 18
Views: 10405
Reputation: 25294
Xcode 9.3.1
STEP 1. Prepare resource folder
In this folder we will prepare images for the application
My app root folder with Resources folder
generateIcons code
nvm install 6
nvm use 6
#https://github.com/dwmkerr/app-icon
npm install -g app-icon
app-icon generate --icon "${0%/*}"/icon.png --platforms=ios
INFOPLIST_MYAPP="${SRCROOT}/SM2/Application/InfoPlist/Info.plist"
ICON_NAME=""
case "${CONFIGURATION}" in
"Debug_Staging" | "AdHoc_Staging" | "Test_Staging" | "Profile_Staging" )
ICON_NAME="icon_Base_Staging.png";;
"Debug_Production" | "AdHoc_Production" | "Distribution" | "Test_Production" | "Profile_Production" )
ICON_NAME="icon_Base_Production.png";;
"AdHoc_Production_SM2_CI" )
ICON_NAME="icon_CI.png";;
*)
;;
esac
cp -r "${SRCROOT}/Resources/${ICON_NAME}" "${SRCROOT}/Resources/icon.png"
${SRCROOT}/Resources/generateIcons
cp -rf ${SRCROOT}/Resources/AppIcon.appiconset/ ${SRCROOT}/SM2/Resources/Images.xcassets/AppIcon.appiconset/
All build schemes
Each time you switch the build scheme, the necessary icons will be created.
Upvotes: 1
Reputation: 1542
Xcode 6 – Xcode 9
Upvotes: 27
Reputation: 13343
Add the icons files only to the relevant target, then add them to you info.plist file under "Icon files" (must be done twice, there's another one for iOS5).
Usually it is done for you if you follow the file naming convention:
for iPhone:
for iPad:
Upvotes: 0
Reputation: 854
It is not necessary to drag your iconfiles to the helpareas on the summary of the target. Just name the files correctly (Icon.png, [email protected] etc.) and add them as resources in your project and make sure to only add them to the bundle of the target they are needed in, and they will be used automagically.
You could create two sets of iconfiles, and when dragging them into your project uncheck the boxes for the targets they are not used in.
Upvotes: 3
Reputation: 3786
Hmm... every time I try to use the externally-referenced icon by dragging it onto the summary pane, a copy is also made to the root directory of my original project- the two icons are trying to live in the same place.
I had disabled the check mark to copy files if necessary, but it does it anyway (Xcode 4) making me think those files need to be in the root to work.
Am I missing something, should I be naming my files differently for the two versions, for example?
Upvotes: 1
Reputation: 9457
Ok I found the answer and it's rather simple. As I already mentioned I duplicated the target that I have - and changed the product name. Then there is the tricky part with the app icon and the splash screen. What I basically did was to delete these files from the project folder and move them to an external folder. Then I would create another external folder for images of the new target. Then I would add references of the images (very important not to copy them!) to the project for each build.
Upvotes: 3
Reputation: 1916
Every target will have a different info.plist file
In this file you can specify icon, splash screens, displayed name ...
Upvotes: 9