12
votes

Whilst trying the AFNetworking iOS example project I noticed that Xcode was displaying the target icon. Xcode does not do the same for my own projects/targets however.

AFNetworking iOS example project that shows the target icon:

AFNetworking iOS example project

A project that does not show the target icon:

A project that does not show the target icon

The only difference I can see between both projects is that the AFNetworking iOS example target has an 'Icon files (iOS 5)' ('CFBundleIcons' raw key) dictionary within *-Info.plist. Surely this cant be the source of the problem though given that my example project is targeting iOS 7? Both targets do have an 'Icon files' ('CFBundleIconFiles' raw key) array within *-Info.plist.

Please could someone help to shed light on where Xcode is looking for the target icon?

5
Have you tried adding the same key to your info file to see?trojanfoe
I have yes, it didn't have any effect (as expected really).Andy Bowskill
Have you tried to switch the project to use the new asset catalog?Florian Mielke
I haven't but the AFNetworking example project also does not use an asset catalog and that displays fine.Andy Bowskill

5 Answers

12
votes

I tried all the above and did not fixed the icon issue. I was using assets catalog for the project and X-Code version was 5.0.2.

Following steps fixed my issue:

  1. Select the Project file from the navigator and select the target which you do not have the icons
  2. Then select Build Phases and expand and Copy Bundle Resources
  3. Add the *.xcassets file to the bundle resources (In my project the file name was Images.xcassets)
  4. Clean and build the target.
6
votes

To get the icon to appear you have to have the App Icon (Icon-72.png) in the root directory of your project.

If you've changed the App Icon name, you must change the correct properties (CFBundleIconFile, CFBundleIconFiles, and CFBundleIcons) in the Info.plist to the changed App Icon file name.

(This part doesn't matter, but I've found it works much better if you do.) Fully qualify your info plist file in your target build settings with the following variable name: $(SRCROOT)/your_plist_file_name.plist (of course changing "your_plist_file_name" to the correct name)

I've also found you have to change your target's info plist to a different plist, then back to the correct plist file in order for the icon to show in the build settings. You'll also have to click away from the project file and then back in order for it to show in the list of targets.

I'm using Xcode 5, but this should work on Xcode 4 and above.

Good Luck.

4
votes

Please flow the step

1)Click on the app icon arrow

enter image description here

2) drag the app icon 120*120 px

enter image description here

3) fisrt time click on the scheme then show the app icon or rest the simulator and again run

enter image description here

2
votes

See this screenshot:

Here Blue are dimensions and red are icon names. Like 57-57 is actually 57-57.png. Put all these icons in the root of the project with .xcodeproj file. Add them into the project. Then set them all accordingly in Target > Project Name > General

Doing this will start showing every icon at its place in XCode automatically. enter image description here

2
votes

If using the Asset Catalog, select Images.xcassets and look in File Inspector. Check the target membership and make sure your target is selected.