Sahil Kapoor
Sahil Kapoor

Reputation: 11803

App Icons not included in build from Xcode

I can't see iOS AppIcon when installing the build from the latest Xcode Beta. What could be the possible error?

I have included the required icon sizes including 1024x1024.

Upvotes: 35

Views: 28448

Answers (23)

Nick Dev
Nick Dev

Reputation: 165

I searched for an answer for hours as well. There appears to be a variety of problems that can cause a blank app icon showing on an iOS device. Based on my searching, I suspect XCode requires very specific parameters for images used as app icons, parameters that are predefined by a user's image creation/editing software that are relatively esoteric. XCode should probably be more lenient.

My solution was to change my image's precision from 16-bit integer, to 8-bit integer. That was it. I had updated my image creation/editing software, GIMP, and noticed the default precision for a new image had changed in an update.

I tried every other solution mentioned by other people, including but not limited to: changing color profile to SRGB, ensuring image sizes were correct, making changes to the info.plist file, ensuring image names correlated with the Contents.json file, rebuilding the app, and restarting my device. It's a frustrating problem. Hopefully this helps someone else.

Upvotes: 0

Nikunj Joshi
Nikunj Joshi

Reputation: 556

After trying various solutions like "Asigning color profile (sRGB IEC61966-2.1) to icons" and "CocoaPods solution" stated above, or "Changing App Icon Source name to different asset name in proect setting", I found one very basic solution as follow:

  1. Clear your project
  2. Clear derived data at (~/Library/Developer/Xcode/DerivedData/)
  3. Go to "Project -> Build Phase"
  4. Find "Copy Bundle Resources" and drag it as the last item of the list
  5. Uninstall application if it is already there, and run project

Find screenshot for better understanding.

Before

enter image description here

After

enter image description here

Note: You can check, what is creating problem for app-icon in your project by simply changing position of "Copy Bundle Resources" to upward direction.

Upvotes: 17

Igor Ribeiro
Igor Ribeiro

Reputation: 57

In my case, I had an asset file called "Images", I had to create an asset file called "Assets". And then create an AppIcon inside.

Step 1

Step 2

Step 3

Step 4

Upvotes: 0

suvantorw
suvantorw

Reputation: 121

As Andrew Dunkin commented on another suggested answer, my image assets were not included in the Copy Bundle Resources build phase. I spent longer than I probably should have looking for this solution so I hope I save someone else some time.

  1. Go to Project -> Build Phases
  2. Open Copy Bundle Resources dropdown
  3. Make sure your folder with your image assets are included in this phase. If not add it. (The name of my asset folder was Assets.xcassets)

Upvotes: 0

kakyo
kakyo

Reputation: 11640

In my case

  • Xcode 10.3
  • macOS 10.14.5

I had a legacy project that used .icns instead of .xcassets. The app insisted on using the old icon even after I ...

  • deleted all icon files;
  • removed all the references to icon files in the Copy Bundle Resources build phase;
  • ensured that no old .icns files included in the output app bundle resources; in fact, there was absolutely no .icns file there!
  • cleaned, deep cleaned project build folder, manually deleted ~/Library/Developer/Xcode/DerivedData before rebuilding;
  • added Assets.xcassets to the project and tested varies renaming of this bundle: images, Images, Icons, etc;
  • created and imported icon-set images that are generated from Icon Set Creator; The icon-set works for an fresh empty macOS Cocoa project.

What worked for me was something among a few desperate trials:

  • Changed the Bundle Identifier and made sure everything still builds: this involves lots of one-click fixes that Xcode suggests to the project metadata, such as this one: https://stackoverflow.com/a/45976427/987846 and regenerating .entitlements.
  • Removed and re-added CFBundleIconFIle property to the target's Info.plist. Name it AppIcon.
  • Set App Icon property in the target's General settings to use my .xcassets.
  • Experienced .xcassets generating another empty AppIcon called AppIcon-2 behind my back, so manually deleted it from .xcassets, then reset the App Icon of the target to AppIcon.
  • Readding .xcassets to the Copy Bundle Resources build phase.

After rebuilding, this time the correct .icns is copied over to the app bundle's resources folder.

Upvotes: 0

Umberto
Umberto

Reputation: 184

After some days of research I figured out the problem, im my case the culprit was xcode 10 beta that cause the missing app icon issue on ios 11.

I downgraded to xcode 9.4.1 and now the icon appear on ios 11 as well.

Upvotes: 0

Asleepace
Asleepace

Reputation: 3755

After trying a bunch of these solutions, this is what solved it for me:

1). Delete any .xcassets folders in any of my Pod folders

Then delete any references to those files in:

2). Pods > Target Support Files > Pods-YourApp-resources.sh

Lastely, under my App > Build Phases > Copy Pod Resources

3). Remove any references to the same .xcassets paths

Afterwards just to be safe I did a Clean, Clean build folder, and then deleted Derived Data. Closed Xcode and reopened, voila!

Hope this helps someone, it took me about half a day as well to iron this out...

Upvotes: 0

zeeawan
zeeawan

Reputation: 6905

In my case none these solutions worked.

My icons were not being shown cause they were NOT IN CORRECT SIZES. Once I resize them correctly then my issue got resolved.

Upvotes: 2

Chris Marstall
Chris Marstall

Reputation: 105

TL;DR: create a "Copy Bundle Resources" Build Phase

After a day and a half trying pretty much every solution on this and other threads, I found a very different fix that worked for me. Looking at app package within my build folder, I noticed that the App Icon png files were not being copied over into it. I created a blank app from scratch, added an app icon, and in that blank app it did copy the icon file over. So what gives?

The blank app had a "Copy bundle resources" build phase that copied the Assets.xcassets package over. Mine didn't. So I created one, added my Images.xcassets, and presto change-o, my archive got validated. NB I am pretty sure I never had that build phase before, yet I was able to submit a build just a month ago ...

Upvotes: 2

Bhanu
Bhanu

Reputation: 1249

This issue comes due to CocoaPods for iOS 11. After few research I found one solution:

 post_install do |installer|
     copy_pods_resources_path = "Pods/Target Support Files/Pods-XXX/Pods-XXX-resources.sh"
     string_to_replace = '--compile "${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"'
     assets_compile_with_app_icon_arguments = '--compile "${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
     --app-icon "${ASSETCATALOG_COMPILER_APPICON_NAME}" --output-partial-info-plist "${BUILD_DIR}/assetcatalog_generated_info.plist"'
     text = File.read(copy_pods_resources_path)
     new_contents = text.gsub(string_to_replace, assets_compile_with_app_icon_arguments)
     File.open(copy_pods_resources_path, "w") {|file| file.puts new_contents } 
end

Just add above to podfile and in terminal, execute pod install. But this above code have limitation. There may such conditions like we have multiple pod then we need to run in loop.

 post_install do |installer|
     installer.aggregate_targets.each do |target|
         copy_pods_resources_path = "Pods/Target Support Files/Pods-Fixr/Pods-Fixr-resources.sh"

         string_to_replace = '--compile "${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"'
         assets_compile_with_app_icon_arguments = '--compile "${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
         --app-icon "${ASSETCATALOG_COMPILER_APPICON_NAME}" --output-partial-info-plist "${BUILD_DIR}/assetcatalog_generated_info.plist"'
         text = File.read(copy_pods_resources_path)
         new_contents = text.gsub(string_to_replace, assets_compile_with_app_icon_arguments)
         File.open(copy_pods_resources_path, "w") {|file| file.puts new_contents }
     end

end

It works fine when there is multiple file.

Upvotes: 1

Michal Fapso
Michal Fapso

Reputation: 1322

In my case the app icon started to show up correctly in Finder after I changed

<key>CFBundleIconFile</key>
<string>AppIcon</string>

into

<key>CFBundleIconFile</key>
<string>AppIcon.icns</string>

in the Info.plist. My XCode version is 8.3.3

Upvotes: 0

Chuck Boris
Chuck Boris

Reputation: 1275

In my case one of the Pods contained .xcasset. Removing it solved the problem.

Upvotes: 0

Aakash Aggarwal
Aakash Aggarwal

Reputation: 150

Problem:

1. App icon not appearing on iOS 11 or Xcode 9.

2. App icon visible on iPhone but not in iPad.

Solution that worked for me:

The issue seems to be with the build process for Xcode 9 and iOS 11. In the past, Apple has been using ~iPad extension to differentiate between the assets for iPhone and iPad.

The info.plist has a dictionary with the key “CFBundleIcons~ipad” which has no items (as it appears in Xcode 9), which is causing the bundle to GET the images from the info.plist file instead of images.xcassets, thus the app icon on Xcode 9 is not appearing.

Deleting this key from .plist file worked for my build, while the others did'nt.

Deleting "CFBundleIcons~ipad" key from .plist

Upvotes: 2

ack
ack

Reputation: 289

Having an incorrect icon size in your icon set can cause the App Icon to not display @iOS11. After many days of investigating, I found this entry in my build log:

Showing All Messages, Filtering for "icon". warning: ApplicationIcons.appiconset/Icon-40@2x.png is 80x80 but should be 60x60.

Whilst this message was present, my app icon was always not displaying (i.e. would see the default iOS app logo). I corrected the problem icon file (swapping it with the correctly sized image), and now my App Icon always displays. For some reason, changing the 'Asset Catalog App Icon Set Name' corrected the issue as a once-off. Subsequent app builds would result in the default icon displaying again.

Upvotes: 0

Bassant Ashraf
Bassant Ashraf

Reputation: 1607

1- Add this code to Podfile:

post_install do |installer|
    copy_pods_resources_path = "Pods/Target Support Files/Pods-IconTest/Pods-IconTest-resources.sh"
    string_to_replace = '--compile "${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"'
    assets_compile_with_app_icon_arguments = '--compile "${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" --app-icon "${ASSETCATALOG_COMPILER_APPICON_NAME}" --output-partial-info-plist "${BUILD_DIR}/assetcatalog_generated_info.plist"'
    text = File.read(copy_pods_resources_path)
    new_contents = text.gsub(string_to_replace, assets_compile_with_app_icon_arguments)
    File.open(copy_pods_resources_path, "w") {|file| file.puts new_contents }
end

2- pod install

note: make sure you replace this: Pods-IconTest/Pods-IconTest-resources.sh

as IconTest is the name of your app

or you can get this path by searching for .sh: (check image)

enter image description here

Upvotes: 0

LucasKarlsson
LucasKarlsson

Reputation: 1039

Answer from gales_vasile: https://forums.developer.apple.com/thread/86290

Worked for me.

It should be a bug in CocoaPods, as disccussed here https://github.com/CocoaPods/CocoaPods/issues/7003 I had the same problem but I fixed it following the next steps:

1) Add this code to Podfile:

post_install do |installer|
    copy_pods_resources_path = "Pods/Target Support Files/Pods-IconTest/Pods-IconTest-resources.sh"
    string_to_replace = '--compile "${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"'
    assets_compile_with_app_icon_arguments = '--compile "${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" --app-icon "${ASSETCATALOG_COMPILER_APPICON_NAME}" --output-partial-info-plist "${BUILD_DIR}/assetcatalog_generated_info.plist"'
    text = File.read(copy_pods_resources_path)
    new_contents = text.gsub(string_to_replace, assets_compile_with_app_icon_arguments)
    File.open(copy_pods_resources_path, "w") {|file| file.puts new_contents }
end

2) Change copy_pods_resources_path for your app and run “pod update”. This should fix your problem!

Upvotes: 1

John Guy
John Guy

Reputation: 441

Another Simple Fix once discovered:

I had the same issue with XCode 9.0, a project that worked perfectly well under XCode 8 and iOS 10 suddenly loses it's icons (only on iPads) when I upgraded the solution.

Tore my hair out, did the sRGB thing, did the Transparency thing.

Turns out I still had the following empty entry in my targets info.plist file

CFBundleIcons~ipad

I'd long ago moved to specifying this in the target build settings.

The solution was to simpy remove this entry from the info.plist file (clicked the helpfull little "-" button. Rebuilt and tested and everything was perfect once more.

Upvotes: 8

ack
ack

Reputation: 289

I spent a whole day wasting time on this. I checked my png files to ensure no transparency, to ensure correct RGB settings, I also changed the podfile as discussed here. Nothing worked. The upgrade to Xcode 9/iOS 11 seemed to break/change something as icons were previously showing for me for the same app.

Anyway, what fixed it for me was to change the name of the iOS App Icon in the Assets.xcassets (Default = AppIcon), and to also change the 'Asset Catalog App Icon Set Name' in the Build Settings to align with the new name.

Strangly, after I got this to work, I updated all my images in AppIcon within Assets.xcassets and I got a blank image again! Repeated above steps and problem solved for second time.

Upvotes: 2

Marc
Marc

Reputation: 225

A easy Way to change the color Profile is using the Automator. Make an Job every file and folder

Screenshot Automator

And save it. then you can mark all Icon Files in your asset and choose the Job. All Profiles for the Icons will be made:)

Upvotes: 0

Matthew Barker
Matthew Barker

Reputation: 638

Edit: This needs to fire in the middle of gym, which I don't know how to do. Running the bug fix as soon as the archive appears in the folder will do the trick. If someone can help improve this, please let me know!

I ran into this problem using Fastlane, and I wrote a shell script that I run as a lane to solve the problem. The fix itself is code from user stubyte in this thread.

Here is my script for archive_fix.sh:

#!/bin/bash

# navigate to latest archive created
cd ~/Library/Developer/Xcode/Archives
foo=$(ls -t | head -n1) && cd $foo
line=$(ls -t | head -n1) && cd "$line"

 # bug fix
find Products/ -name Info.plist -print0 | xargs -0n1 plutil -replace BuildMachineOSBuild -string 16A323

Inside my Fastfile, I ran:

sh("./archive_fix.sh")

Upvotes: 2

Damo
Damo

Reputation: 12900

For clarity, make sure that the color profile is set to: sRGB IEC61966-2.1. My icons had no color profile before I stumbled across this issue.

I'm sure other color profiles must work but I haven't done the testing to be sure.

This can be done in preview by:

  1. Tools → Assign Profile

Assign Profile1

  1. Select sRGB IEC61966-2.1

Assign Profile2

When you do a Get Info on the icons it should now say the correct Color Profile.

Example of working / non working Get Info on two images

Upvotes: 22

grwilde
grwilde

Reputation: 381

I had the same problem with my App icons. They displayed on some devices but not on others. I looked further into the problem and found that not all of my icons had been flattened and all had an incorrect color space (Adobe RGB). I flattened all icons and converted to SRGB color space, then replaced the existing icons. All icons show perfectly now.

Upvotes: 13

Duncan Babbage
Duncan Babbage

Reputation: 20187

You are not alone.

In my project, I found that a previous AppIcon resource that was working fine no longer resulted in an app icon being rendered. A range of experimentation found the following:

  • An AppIcon resource copied in from another project where the AppIcon worked, resulted in the AppIcon working in this project, suggesting there was something wrong with the specific original AppIcon resource that wasn't working.
  • Copying the image files from the non-working to the working AppIcon asset resulted in the working one now failing also.
  • Creating a new AppIcon resource, and inserting the original app icon images likewise led to a blank app icon.

Combined together, the points to this stage suggested perhaps there was something wrong with the image files themselves. I therefore tried various steps to resolve this:

  • Re-exporting all the icon sizes with my usual pre-processing app Prepo. Ensured that my source image did not contain transparency. Inserting those re-created icon images still resulted in a blank app icon.
  • Re-creating all the icon sizes with a different process, via Sketch, and inserting those icon images into the same AppIcon resource resulted in the app icon working.
  • Creating a new AppIcon resource, and inserting the Sketch-created images resulted in the app icon still working.

All of the above suggests that there is something in Xcode 9 which rejects or fails to use previously working app icon images, and that some processes to create app icons that previously were fine produce images that Xcode 9 cannot use. Perhaps there is something within the png specification which is a valid png, but not an acceptable app icon to Xcode 9. The most obvious thought is that app icons with transparency might be rejected, but I do not believe the icon images I was using contained transparency and I tried to eliminate this in my testing above.


A completely separate cause that has been reported for some users is related to CocoaPods integration. See discussion with possible temporary fix here and a pull request that has been created for Cocoapods that theoretically addresses this issue. I say theoretically addresses because I've tried implementing both of these solutions, and neither of them resolved the issue on the project where I've encountered it.

Upvotes: 30

Related Questions