今天更新Xcode 9 后,在運(yùn)行老項(xiàng)目時(shí)遇到一個(gè)小坑,就是無論如何都不顯示AppIcon,在網(wǎng)絡(luò)上找到了方法,單并沒有解決,其實(shí)不是方法的問題,只是有一個(gè)小細(xì)節(jié)要注意,在這里提示一下.
出現(xiàn)這個(gè)問題的原因就是cocoapods與iOS 11出現(xiàn)點(diǎn)問題,這里你要更新你的cocoapods至最新版本.然后在你的Podfile文件中添加如下代碼.這里一定要注意,要在end下面,如圖所示
代碼:
post_install do |installer|
copy_pods_resources_path = "Pods/Target Support Files/Pods-FuelCardApp/Pods-FuelCardApp-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
Snip20171013_9.png