首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >iOS项目中的命令脚本问题

iOS项目中的命令脚本问题
EN

Stack Overflow用户
提问于 2016-02-02 16:34:06
回答 3查看 598关注 0票数 1

我得到了一个想要用iOS编译的XCode项目。

当我构建它时,我会得到以下错误:

代码语言:javascript
复制
(!)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阶段时,没有运行脚本阶段。

编辑

我在“构建阶段”>“获取应用程序版本”中找到了该脚本

代码语言:javascript
复制
Shell: /bin/sh
Version='agvtool vers -terse'
sed -e "s/CURRENT_VERSION/$Version/g" Resources/App/version.h.tpl > GeneratedFiles/version.h

如果我添加echo $Version,就会得到以下内容

代码语言:javascript
复制
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
EN

回答 3

Stack Overflow用户

回答已采纳

发布于 2016-02-03 08:23:18

这是一个错误:

代码语言:javascript
复制
sed: 1: "s/CURRENT_VERSION/There ...": unescaped newline inside subtitute pattern

我认为问题在于>之后的新行。您的脚本应该是3行,而不是4行

代码语言:javascript
复制
Shell: /bin/sh
Version='agvtool vers -terse'
sed -e "s/CURRENT_VERSION/$Version/g" Resources/App/version.h.tpl > GeneratedFiles/version.h

或者$Version包含一个\n

而不是

您也许可以完全删除该构建脚本。

票数 1
EN

Stack Overflow用户

发布于 2016-02-02 16:42:36

脚本可能包含在“构建”计划中,作为“行动后”或“行动前”。

单击“编辑方案.”,然后单击“构建方案”中的“公开三角”,然后检查“预操作”和“事后操作”中的条目。

票数 1
EN

Stack Overflow用户

发布于 2017-01-12 02:34:53

我经常遇到这样的问题,所以我会在这页的评论中留下这个工作上的答案,以此提醒我自己:

发生此问题是因为项目文件夹中有多个项目!

解决方案是什么?删除任何额外的项目,只留下一个您打算首先运行的项目.xcodeproj

票数 -1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/35158872

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档