2016-02-02 117 views
1

我得到一個我想用XCode編譯的iOS項目。
當我建造它,我得到以下錯誤:
iOS項目的命令腳本問題

(!)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. 

在該項目中,當我去到目標>構建階段就沒有運行腳本階段。

編輯
我發現劇本中 '構建階段'> '獲取應用程序版本'

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 
+0

所以你已經檢查了所有的目標>構建階段,如果他們中的任何一個包含此代碼?他們不需要被命名爲「運行腳本」。 –

+0

是的,我檢查了它 –

+0

如果它不在你使用的構建方案中,而不是在目標>構建階段,那麼我就沒有想法。 –

回答

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

相反

,你可能只需要刪除構建腳本完全

+0

現在沒有你編輯它;)嘗試呼應'''$ Version''',它可能不止一行 – Casey

+0

請參閱我的編輯 –

+0

不應該''agvtool vers -terse''是'$ (agvtool vers -terse)'(或倒勾)? – trojanfoe

1

腳本可能是包括在「構建」計劃中作爲「後續行動」或「行動前」。

點擊「Edit Scheme ...」,然後點擊Build Scheme中的顯示三角,然後檢查「Pre-actions」和「Post-actions」中的條目。

+0

前動作和後動作中沒有動作 –

+1

嗯,根據你的日誌,它可能是一個「運行腳本階段」添加到目標編輯器的「構建階段」選項卡中。確保你正在尋找正確的目標。也公開構建階段,因爲它們可以被重命名爲別的東西。我很確定,有什麼;) – CouchDeveloper

+0

謝謝我在「獲取應用程序版本」選項卡中找到了腳本。你能看看劇本嗎?它是否包含錯誤? –

0

我保持絆腳石進入這樣的問題,所以我會離開這個頁面的評論這個工作答案,以提醒自己在未來:

This problem happens because there are multiple projects on the project folder!

解決方案?刪除任何額外的項目,只留下您打算首先運行的項目.xcodeproj