4

After updating to Xcode 9 (9A235), app icon was missing after running on iOS 11. It was working fine in previous version. This issue is caused by CocoaPods. I have tried this solution but this is giving me error.

An error occurred while processing the post-install hook of the Podfile.

Saqib Omer
  • 5,387
  • 7
  • 50
  • 71

4 Answers4

8

Try adding this script in your podfile.

post_install do |installer|
    installer.aggregate_targets.each do |target|
        copy_pods_resources_path = "Pods/Target Support Files/#{target.name}/#{target.name}-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

More information about this issue you can find here.

VitGur
  • 539
  • 9
  • 13
8

Problem:

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

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

Solution that worked for me:

This issue generally resolves problems for the apps made on or before Xcode 7.

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 didn't.

Remove the key titled "CFBundleIcons~ipad"

Aakash Aggarwal
  • 150
  • 2
  • 8
6

After trying every option from above, to no avail, I checked the "Asset Catalog App Icon Set Name" in my Build Settings in Xcode, and I noticed it was empty. So I simply set this to "AppIcon" (or whatever your app icon set is named in the asset catalog) and it worked immediately.

Note: if you have your Build Settings set to "Basic" or "Customized" this setting may not show up. As a result, set it to "All"

Scott D
  • 1,394
  • 1
  • 13
  • 17
2

Have a look at my solution here: https://stackoverflow.com/a/48209677/391605

Basically, it seems like, with Xcode 9.x, there are extra icons in the Image Sets, especially for iPads. If you create yourself a "New iOS App Icon", and tell Xcode to use that as your app's icon, it fixes this issue.

enter image description here

Mike Gledhill
  • 27,846
  • 7
  • 149
  • 159