原文连接http://blog.csdn.net/NLYNN/article/details/78048109?locationNum=3&fps=1
升级到iOS11系统下自己的项目桌面app图标不见了, 自己在Xcode9下新建一个工程看一下, 设置图标是显示的, 但是假如CocoaPod就不显示了. 多方查询发现
图标不显示主要是cocoaPod出现了问题, 需要在podfile文件加入以下脚本 [标红的地方]
1.加入脚本
platform :ios, '8.0'
target ‘lqz’ do
pod 'MJRefresh'
pod 'AFNetworking'
end
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
!!!!警告, 将[工程名]
换成自己工程的名称!!!!!!
到当前工程目录 执行 $ pod install
3.打开文件手动修改
打开下面的文件
**Pods-
[工程名字]
-resources.sh**
image[图片上传失败...(image-a957b9-1510130544599)]
修改前:
printf "%s\0" "${XCASSET_FILES[@]}" | xargs -0 xcrun actool --output-format human-readable-text
--notices
--warnings --platform "${PLATFORM_NAME}"
--minimum-deployment-target "${!DEPLOYMENT_TARGET_SETTING_NAME}" ${TARGET_DEVICE_ARGS}
--compress-pngs --compile "${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
修改后:
printf "%s\0" "${XCASSET_FILES[@]}" | xargs -0 xcrun actool --output-format human-readable-text --notices --warnings --platform "${PLATFORM_NAME}" --minimum-deployment-target "${!DEPLOYMENT_TARGET_SETTING_NAME}" ${TARGET_DEVICE_ARGS} --compress-pngs --compile "${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" --app-icon "${ASSETCATALOG_COMPILER_APPICON_NAME}" --output-partial-info-plist "${BUILD_DIR}/assetcatalog_generated_info.plist"
到此, 重新打开工程即可!!
网友评论