xcode 尝试将 shell 脚本作为构建步骤运行时,Xcode4 出现 shell 脚本调用错误

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/6173779/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-14 21:08:52  来源:igfitidea点击:

Shell Script Invocation Error with Xcode4 when trying to run a shell script as a build step

xcodexcode4xcodebuild

提问by sorin

Here is what I get when I try to build my Xcode project:

这是我尝试构建 Xcode 项目时得到的结果:

Intermediates/demo2.build/Debug-iphonesimulator/demo2.build/Script-5E564EAC1393823C00BFBA83.sh

/Users/ssbarnea/Library/Developer/Xcode/DerivedData/demo2-fdzrmxojwtekcbeivraccjjadvqz/Build/Intermediates/demo2.build/Debug-iphonesimulator/demo2.build/Script-5E564EAC1393823C00BFBA83.sh: line 2: ${PROJECT_DIR}/local-deploy.sh: No such file or directory

In Xcode I added to the default arget a new Build Phase, a "Run Script" that runs with shell /bin/shand contains only:

在 Xcode 中,我在默认参数中添加了一个新的构建阶段,一个与 shell 一起运行的“运行脚本”,/bin/sh仅包含:

'${PROJECT_DIR}/local-deploy.sh'

I can assure you that the local-deploy.sh file exists in the project directory and that it is executable. It even works if I call it from the console ;)

我可以向您保证,local-deploy.sh 文件存在于项目目录中并且是可执行的。如果我从控制台调用它,它甚至可以工作;)

采纳答案by Kazuki Sakamoto

It should be the following. s/'/"/g :-)

应该是下面这样。s/'/"/g :-)

"${PROJECT_DIR}/local-deploy.sh"

回答by Harsh Thaker

Well, I don't think that replacing this will work. You need just put OpenCV.frameworkfolder in proper project folder and I think that is it. I tried out and it worked.

好吧,我不认为替换它会起作用。您只需将OpenCV.framework文件夹放在正确的项目文件夹中,我认为就是这样。我试过了,它奏效了。