我得到一个 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 Phases 时,没有运行脚本阶段。
编辑
我在“构建阶段”>“获取应用程序版本”
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
最佳答案
这是错误:
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
改为
你可以完全删除那个构建脚本
关于ios - iOS 项目上的命令脚本问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35158872/