我得到了一个想要用iOS编译的XCode项目。
当我构建它时,我会得到以下错误:
(!)Run custom shell script 'Get App Version'
_________________________________________________________________
| PhaseScriptExecution Get\ App\ Version /Users........./Script- 9AAC7B315646546DC5.sh
| cd ....
| export ....
| ....
| long scripts
| ....
|_________________________________________________________________
sed: 1: "s/CURRENT_VERSION/There ...": unescaped newline inside subtitute pattern
Command /bin/sh failed with exit code 1.在项目中,当我进入Target > Build阶段时,没有运行脚本阶段。
编辑
我在“构建阶段”>“获取应用程序版本”中找到了该脚本
Shell: /bin/sh
Version='agvtool vers -terse'
sed -e "s/CURRENT_VERSION/$Version/g" Resources/App/version.h.tpl > GeneratedFiles/version.h如果我添加echo $Version,就会得到以下内容
There are multiple projects in this directory. agvtool does not work with multiple projects in the same directory. agvtool - Apple-generic versioning tool for Xcode projects usage: agvtool help agvtool what-version | vers [-terse] agvtool [-noscm | -usecvs | -usesvn] next-version | bump [-all] agvtool [-noscm | -usecvs | -usesvn] new-version [-all] <versNum> agvtool [-noscm | -usecvs | -usesvn] tag [-force | -F] [-noupdatecheck | -Q] [-baseurlfortag] agvtool what-marketing-version | mvers [-terse | -terse1] agvtool [-noscm | -usecvs | -usesvn] new-marketing-version <versString>
sed: 1: "s/CURRENT_VERSION/There ...": unescaped newline inside substitute pattern
Command /bin/sh failed with exit code 1发布于 2016-02-03 08:23:18
这是一个错误:
sed: 1: "s/CURRENT_VERSION/There ...": unescaped newline inside subtitute pattern我认为问题在于>之后的新行。您的脚本应该是3行,而不是4行
Shell: /bin/sh
Version='agvtool vers -terse'
sed -e "s/CURRENT_VERSION/$Version/g" Resources/App/version.h.tpl > GeneratedFiles/version.h或者$Version包含一个\n
而不是
您也许可以完全删除该构建脚本。
发布于 2016-02-02 16:42:36
脚本可能包含在“构建”计划中,作为“行动后”或“行动前”。
单击“编辑方案.”,然后单击“构建方案”中的“公开三角”,然后检查“预操作”和“事后操作”中的条目。
发布于 2017-01-12 02:34:53
我经常遇到这样的问题,所以我会在这页的评论中留下这个工作上的答案,以此提醒我自己:
发生此问题是因为项目文件夹中有多个项目!
解决方案是什么?删除任何额外的项目,只留下一个您打算首先运行的项目.xcodeproj!
https://stackoverflow.com/questions/35158872
复制相似问题