LoginSignup
5
3

More than 5 years have passed since last update.

R.swiftアップデート後ビルドエラー

Last updated at Posted at 2019-01-17

内容

R.swiftを5系にアップデート後ビルドしたところ、エラーがでました。

[R.swift] Build phase Intput Files does not contain '$TEMP_DIR/rswift-lastrun'
[R.swift] Output path must specify a file, it should not be a directory.
[R.swift] Build phase Output Files do not contain '$SRCROOT/Common/R.generated.swift'.

スクリプトの記法が違うみたいです。

エラーが教えてくれている通り、Build Phase の Input Files, Output path, Output Filesをそれぞれ修正で問題なくエラーが消えます
(自分の場合はR.generatedファイルをData層等他のターゲットでも生成していたので、そちらでもスクリプトの修正をしないといけないのに見落としてたから時間がかかりましたが)
スクリーンショット 2019-01-17 15.40.28.png

そもそもGitHubでR.swift/Documentation/Migration.md みるとsee an example screenshotに画像つきでありますね。やっぱり公式見るの大事。

補足

そもそもRun Scripitと、環境変数、その意味みたいなところがわからなかったので軽くメモ
Run Script: 実行したいファイルのパスを書くとビルド時に指定されたファイル内容が実行される
環境変数: 今回の記事でいうと、TEMP_DIRやSRCROOTがそれに当たる。ディレクトリを格納した変数。
*それぞれの環境変数が何を指すかはAdd Run Script Build PhaseでRun Scriptを追加して、Shell下の入力欄に
' env > ./env.txt' と入力後ビルドするとenv.txtファイルが生成されるのでその中に書かれている。
スクリーンショット 2019-01-17 16.11.49.png

5
3
2

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
3