Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xcode target icon not displayed

Tags:

xcode

ios

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?

like image 489
Andy Bowskill Avatar asked Sep 24 '13 13:09

Andy Bowskill


People also ask

How do I see targets in Xcode?

When you create a new project from a template, Xcode adds one or more targets to the project automatically. For example, the multiplatform app template contains separate targets for an iOS app and Mac app. To view the targets in a project, select the project in the navigator area.

How do I add a target in Xcode?

Navigate to your . xcodeproj file, select the newly created Target (“MultipleTargets_Dev” in this case), select “Build Settings” and search for “other swift flags”. Note: It's mandatory to include “-D” as a prefix for Custom / Swift Flags.

What is an Xcode target?

A target is an end product created by running "build" in Xcode. It might be an app, or a framework, or static library, or a unit test bundle. Whatever it is, it generally corresponds to a single item in the "built products" folder. A scheme represents a collection of targets that you work with together.

How do I change project target in Xcode?

Changing the target name is just as simple. Click on the project name at the top left, then select a target name on the right pane followed by pressing "Enter".


2 Answers

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.

like image 173
Matt W. Avatar answered Oct 04 '22 20:10

Matt W.


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

like image 40
Vaibhav Saran Avatar answered Oct 04 '22 19:10

Vaibhav Saran