運(yùn)行條件:
工具:Xcode9
模擬器 真機(jī)效果都是不顯示
在之前的老項(xiàng)目中新建Assets.xcassets
image.png
點(diǎn)擊這兩處也是能正常跳轉(zhuǎn)的,經(jīng)過(guò)多番對(duì)比,這里沒(méi)有顯示
Assets.xcassets
,添加上,icon實(shí)正常顯示的,但是LaunchImage不正常image.png
選中LaunchImage ,這么設(shè)置就好了
image.png
當(dāng)然網(wǎng)上也有說(shuō)更新Xcode9造成cocoapods出問(wèn)題了
今天遇到老項(xiàng)目在iOS11上運(yùn)行,icon不顯示的問(wèn)題。經(jīng)過(guò)查資料并實(shí)踐,以下方法解決了我的問(wèn)題。
- 1) 在
podfile
中添加如下代碼(注意:下面的代碼要寫在end后面,如圖所示)
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
填入你的項(xiàng)目名。
- 2)
cd 到你的項(xiàng)目所在文件夾中,執(zhí)行 pod install
,再重新運(yùn)行,即可顯示。