Rodrigo
Rodrigo

Reputation: 12683

2 Targets 1 Icon Name

My program has two targets and I want to correctly configure this screen:

the screen

I successfully configure the "App Icon" and "Launch Images" in .plist file, setting the key CFBundleIconFile and CFBundleIconFiles (for icon) and UILaunchImageFile (for launch Image) in the .plist file.

To see this error yourself, try the following:

  1. Create a new project
  2. Create two or more targets for this project
  3. Go to the screen above (select the project icon in XCode, in targets select the "summary" tab)
  4. Select an image to be the icon of this target
  5. The icon will be added to the project and automatically saved in the root project directory in the file system with the name "Icon.png"
  6. Go to another target and select another image to be the icon of this target
  7. Here is the problem. The system will say: "Want to replace this file?" If I say yes, it overwrites and the first target icon is replaced!!! If say no, nothing is done.

Is there a way to configure two different icons and two launch images to appear in this screen for each target? I can correctly configure it in the .plist file, but in this screen it looks like I have no image!

Upvotes: 2

Views: 647

Answers (1)

Mike Keskinov
Mike Keskinov

Reputation: 11878

You need store icons in different folders.

  1. Create 2 subfolders in "images" (in file system, not in Xcode)

In file system

 2. Create corresponding "group" (yellow folder) in Xcode and set right path for them (optional)

 3. Add all icons to project (in corresponding groups)

In XCode

 4. Set "Target membership" (in the right panel in Xcode) to right target for each icon.

enter image description here

 5. The info.plist file(s) should reference to right icon name.

enter image description here

Also be aware of:

  • All files from subfolders of "images" will be placed in one root folder in device's file system, so it is never mind, that images located in different folders in developer's machine. If you have files with some name in different folders, only one may be placed in final bundle. It is why you need specify "Target membership".

  • Do not set arbitrary names for lancher icons. Some devices may no recognize icon, if it named arbitrary, ever if it is mentioned in info.plist file (see here).

Upvotes: 4

Related Questions