Xcode scheme pre-action script not running

前端 未结 2 1822
难免孤独
难免孤独 2021-02-01 02:18

Hit build and nothing gets printed in build log. What gives?

Xcode Version 8.2.1 (8C1002)

2条回答
  •  失恋的感觉
    2021-02-01 02:54

    Pre-action takes place before the build, so output doesn't go to the build log, it goes to stdErr. You can copy the output to a file:

    exec > ${PROJECT_DIR}/prebuild.log 2>&1
    echo "hello world"
    

    To get the environment variables to work, you also need to set "Provide build settings from" to the appropriate target.

    That should write hello world to a file named "prebuild.log" in your project folder.

    If you want these activities to end up in the build log, consider adding a run script to your target's build phase instead.

提交回复
热议问题