Run Script Phase after dSYM is generated with Xcode 10 (on build)

Deadly 提交于 2019-12-06 13:32:25

A similar question can be found here:

Build phase script is running before needed files are created in Xcode 10

You need to add the dSYM as an input file dependency of your run script phase:

dSYM default location is ${DWARF_DSYM_FOLDER_PATH}/${DWARF_DSYM_FILE_NAME}

You can test this using a short script and observing its output:

#!/bin/sh

if [ ! -d ${DWARF_DSYM_FOLDER_PATH}/${DWARF_DSYM_FILE_NAME} ]; then
    echo "Couldn't find dsym file"
    exit 1
fi

stat -x ${DWARF_DSYM_FOLDER_PATH}/${DWARF_DSYM_FILE_NAME}

For me proposed solution didn't work. In my case I had to know when Info.plist file inside dSYM is generated. Though script started when file is there its size was zero and script failed.

What worked for me is 5s sleep as first line in my script:

sleep 5

Roi Tai's answer is almost correct. Specifying only ${DWARF_DSYM_FOLDER_PATH}/${DWARF_DSYM_FILE_NAME} is just the dSYMs folder and not the dSYM file itself.

I actually fully resolved the issue without having to use sleep in my script. The Input File path needs to be the following:

${DWARF_DSYM_FOLDER_PATH}/${DWARF_DSYM_FILE_NAME}/Contents/Resources/DWARF/${TARGET_NAME}

I was experiencing this issue when attempting to upload dSYMs to Sentry in my Build Phases. When specifying this full file path, the script waits for the dSYM to be fully generated before executing - no sleep call needed!

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!