程序不显示icon 和LaunchImage?

运行条件:

工具:Xcode9
模拟器 真机效果都是不显示
在之前的老项目中新建Assets.xcassets

程序不显示icon 和LaunchImage?_第1张图片
image.png

点击这两处也是能正常跳转的,经过多番对比,这里没有显示 Assets.xcassets,添加上,icon实正常显示的,但是LaunchImage不正常
程序不显示icon 和LaunchImage?_第2张图片
image.png

选中LaunchImage ,这么设置就好了
程序不显示icon 和LaunchImage?_第3张图片
image.png

当然网上也有说更新Xcode9造成cocoapods出问题了

今天遇到老项目在iOS11上运行,icon不显示的问题。经过查资料并实践,以下方法解决了我的问题。

  • 1) 在podfile中添加如下代码(注意:下面的代码要写在end后面,如图所示)
    程序不显示icon 和LaunchImage?_第4张图片
    image.png
post_install do |installer|
    copy_pods_resources_path = "Pods/Target Support Files/Pods-[工程名]/Pods-[工程名]-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)
    cd 到你的项目所在文件夹中,执行 pod install,再重新运行,即可显示。

你可能感兴趣的:(程序不显示icon 和LaunchImage?)