9

What I am trying to achieve is for the application icon to be different in builds that I send out to my beta testers, to that of the application that will be submitted for approval. This will allow me and my beta testers to easily identify the app is a beta version.

I was not sure if I should be adding a build script to modify the info.plist and change the application icon specified there. For this I guess I would have to conditional check the build type (DEBUG/RELEASE/DISTRIBUTION etc) and write the appropriate value to the plist file.

Alternatively I thought I might need to create a separate target for beta releases and specify the new BETA application icon there.

If anyone has done this kind of procedure before, any tips and ideas about how best to do it would be very much appreciated.

3 Answers 3

12

Outdated: As of September 2017, my answer is probably outdated now. Please use latest Apple developer guides relating to Asset Catalogs. Asset Catalogs are the new way of specifying image/icon resources for your app.

Original answer:

Both ways you have mentioned can be used for this purpose (Through a separate Target or using Build settings). In my opinion, the more logical way would be to use a different build configuration and set the plist file to dynamically get the icon file name from the build configuration.

Here is how I would do it:

  1. In project build settings, create a new user-defined variable called ICON_FILE (for "All Configurations")
  2. Set the value of the variable to "Icon.png" (for "All Configurations")
  3. Create a new build Configuration called "Beta".
  4. Set the value of the ICON_FILE variable to "Icon-beta.png" for "Beta" configuration.

(this will make all the configurations have the value "Icon.png" except Beta config)

In the Info.plist set the value of "Icon file" attribute to ${ICON_FILE}. This will make the info.plist dynamically get the filename from the variable you defined earlier.

In your application resources, include the beta icon with the name "Icon-beta.png" in addition to "Icon.png" you already have.

If you build the app using "Beta" config, the app will have the beta icon as the app icon.

Hope this helps!

Sign up to request clarification or add additional context in comments.

6 Comments

come to think of it, you can achieve the same functionality with "Targets" with much less work.
Thanks, that's a big help. I was leaning towards the seperate target idea more, since I could specify which resources were deployed in each target. I would still be interested in hearing other people thoughts or experiences on the subject.
Did you know, how to use Icons from xcassets catalog? I tried to scpecify AppIcon and AppIcon-beta, and use this names in ICON_FILE variaable, but there is no effect.
@JohnErck Hi! I solve this problem, look at my answer below: stackoverflow.com/a/24426622/1698467
The use of icons using the config / files option as described on the answer will now generate an invalid binary for App Store. On iOS 11, it is now mandatory to add an assets catalogue for all icons (and don't forget the marketing icon 1024x1024 also).
|
11

Asset catalogs can be used without creating another target.

Here are the steps I use:

1 - Create two (or more) app icon set in images.xcassets

appIcon1 appIcon2

2 - Create another configuration from project settings

demo configuration

3 - Go to Target -> Build Settings and search for app icon. You will see Asset Catalog App Icon Set Name under Asset Catalog Compiler - Options. Change the asset catalog name that will be used in new configuration.

app icon set name for configurations

4 - Build for different configurations.

simulator screen shot

1 Comment

This works but has the drawback of adding both iconsets into the binary. With iOS 11, the use of assets catalogue is now mandatory.
1

The accepted answer is not working for xcassets. So, if you already started to use xcassets catalog here is the steps:

You need to create 2 different targets of your application. To do this:

  1. Right click on your target. -> Click Duplicate (or Cmd+D)
  2. Set name of new target like MyApp-beta

Create separate icon:

  1. Go to your xcasset catalog.
  2. Right click on column with list of images -> click New App Icon
  3. Name it like icon-beta, add place here your beta icons
  4. Click on your beta-target
  5. Go to tab General -> App Icons -> select your asset icon-beta

Here it is. Now you can build your beta application!

Another advantage of this method over that described in the accepted answer - is that you can install both versions at the same time of your Application. (you need to set different Bundle Identifier for this).

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.