Asset Catelog issue with multiple targets

旧时模样 提交于 2019-11-28 20:48:30

When you are adding the app icon image please note while adding app icon-1 to Test target then select only test target not Test copy target same for Test copy target.

Also add row for "Icon file" in both the plist and specify your app icon names.

Please check following screen shots you will get some ideas.

If you're using PODs in your project, then you have to edit "Pods-resources.sh" and remove "xcassets" commands (see attached picture).

CedricSoubrie

The easiest way for me was to add multiple "App Icon" in the same xcassets file. With this technique, I had no problem with Cocoapod :

  1. Open your xcassets file
  2. Right click on the left column
  3. Click "New App icon"

Then you can easily select the correct "App Icon" for each target.

So I wrote a script to delete all those lines which are pointed out by Lukapple.Paste the code to run Script in the xcode project after Target Dependencies.

echo "run script to remove Pods-resources.sh"
file_name="${PROJECT_DIR}/Pods/Target Support Files/Pods/Pods-resources.sh"
function remove_wrapper_extensions {cat "$1" | awk 'BEGIN { suppress_output = 0; } /^if \[\[ -n/ { suppress_output = 1; } (!suppress_output) { print $0; } /^fi$/ { suppress_output = 0; }' > "${1}.1"}
function remove_case_statement {cat "$1" | awk 'BEGIN { suppress_output = 0; } /\s*\*\.xcassets\)$/ { suppress_output = 1; } (!suppress_output) { print $0; } /;;/ && (suppress_output) { suppress_output = 0; }' > "${1}.2"}
remove_wrapper_extensions "$file_name"
remove_case_statement "${file_name}.1"
rm "${file_name}"
rm "${file_name}.1"
mv "${file_name}.1.2" "$file_name"
chmod +x "${file_name}"
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!