Cannot get app icons to work in Xcode 6
Asked Answered
P

6

6

I cannot for the life of me get this to work. Here's what I'm doing:

  • Create a brand new project for iPhone.
  • In Project > General, project is already set to get app icon from the default asset catalog.
  • Go into the asset catalog > AppIcon and drop in images as appropriate.
  • Build and run. No icon.
  • Check Project > Build Settings > Asset Catalog App Icon Set Name. It is correctly set to AppIcon.
  • Check the images.xcassets file and make sure it has the right target membership.
  • Check Project > Build Phases > Copy Bundle Resources and verify that images.xcassets is in there.

Still nothing. I am going INSANE. Someone please tell me I forgot a checkbox somewhere. Please?

Preconize answered 11/9, 2014 at 3:22 Comment(4)
Are you absolutely sure that icons are being added to the project. I just created a new project in Xcode GM, dropped in some app icons in the the Images.xcassets AppIcon folder and the icon showed up on the first build. Have you tried doing a control-click on the AppIcon in the Images.xcassets and clicked "show in finder" to be sure that your project has a reference to the image files?Laboy
Thanks for the speedy reply, Tim. I figured it out -- the images were bad somehow. Details in the answer below.Preconize
@BrianRak Thanks for these steps. What does this mean? Check the images.xcassets file and make sure it has the right target membership. How do you check target membership? I googled but couldn't find anything.Bernadettebernadina
@Bernadettebernadina I'm not in front of my Mac right now so I might have a detail or two wrong, but if you select a project resource and then look in the Inspector pane, under (I believe) the File tab, there's a section with checkboxes where you can say which targets the file should be included in. Checking the box here should have the same effect as adding the file via Project > Build Phases > Copy Bundle Resources.Preconize
P
5

The problem was with the images. I haven't been able to figure out exactly what was wrong with them. Resaving them with a different editor caused them to start working in my project.

In case it helps anyone, these were the details of my scenario:

  • I created the images programmatically using Inkscape.
  • The files were all 32-bit PNGs.
  • I confirmed by examining the binary files that interlacing was turned off, as Apple recommends.
  • Resaving as 32-bit PNGs using Fireworks resulted in working files.
  • I compared the good and bad files and only the headers were different. I'm not sure what the poisonous chunk was, but I did notice that the pHYs dimensions were different between the good and bad files (good: 00 00 0B 12, bad: 00 00 0B 13, which both correspond to 72 dpi). Obviously DPI shouldn't matter here, but I do vaguely remember a case where I had trouble with images that didn't have a certain DPI written into them in the past.

At any rate, I dearly hope this saves someone else some hair pulling.

Preconize answered 11/9, 2014 at 4:22 Comment(1)
I have a similar issue, Ive put in the app icon sizes. It builds but I get many warnings for 60x60@2x is required, i have an unassigned image, 29x29=58, 40x40=80, 80x80=120, 60x60=120 and I get not app launch icon. I have a 29, 40, 60, 80, 87, 120 & 180.Ribbon
C
2
  1. Make sure under Settings > General > App Icons and Launch Images that App Icons Source is set to AppIcon
  2. Under Images.xcassets include the image files with the correct dimensions (refer to image below)
  3. Your icon must be a .png, & you must follow sizing according to this documentation: https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/MobileHIG/IconMatrix.html

In case the link should die it goes something like this (more sizing constraints for settings icon, toolbar and navigation bar icon, tab bar icon, etc..):

App icon sizing for iPhone 6 Plus (@3x): 180x180
app icon sizing for iPhone6 and iPhone5(@2x): 120x120

app icon sizing for iPhone 4s (@2x): 120x120

app icon sizing for iPad and iPadmini(@2x): 152x152

Cryptanalysis answered 22/12, 2014 at 19:56 Comment(1)
You should consider including a snippet of the relevant documentation just in case that link should ever die.Halflight
N
2

In case someone else runs into this again: I had trouble getting icons to work because the asset catalog was not in the root resource folder but in a subfolder, that's obviously not allowed for icons (Xcode 7)

Nitrite answered 6/7, 2016 at 12:39 Comment(0)
I
0

After changing some code, I noticed the app icon stopped working. I looked at the diff, and in the YourProject.xcodeproj/project.pbxproj file, Xcode changed a line from

24E9FAB41A9C9E410054E235 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = "<group>"; };

to

24E9FAB41A9C9E410054E235 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder; path = Images.xcassets; sourceTree = "<group>"; };

I opened up the file in a text editor, changed the lastKnownFileType back to folder.assetcatalog, rebuilt the app, and the app icon showed up again.

Interlard answered 9/4, 2015 at 2:45 Comment(0)
D
0

Had the same problem and the reason for that was which application was used for creating the app icons. In particular they failed to appear when generated by Asset Generator but were successful when using Icon Set Creator (both are OS X desktop applications)

Debbee answered 23/8, 2015 at 9:26 Comment(0)
C
0

My project managed to pick up an images.xcassets file that was not included int the target's membership. I have multiple xcassets files, so I looked through them in the organizer to find the correct file, and checked its box in the Target Membership panel. Work now.

Clasping answered 6/10, 2016 at 18:35 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.