App Icon missing iOS 11

两盒软妹~` 提交于 2019-11-29 04:54:44

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.

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.

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"

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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!