3
2

More than 3 years have passed since last update.

pod install実行時に`target overrides the OTHER_SWIFT_FLAGS build setting defined`が表示され、追加したライブラリがロードできない

Last updated at Posted at 2021-02-20

環境

Xcode Version 12.4
MacOS BigSur 11.2.1

発生した問題

プロジェクトのPodfileにSnapKitを追記し、pod installを実行したところ、
Cannot load underlying module for ‘SnapKit'という問題が発生しました。
追加したライブラリのインポートはできるがロードができていない様子。

$ pod install

Analyzing dependencies
Downloading dependencies
Installing SnapKit (5.0.1)
Generating Pods project
Integrating client project
Pod installation complete! There are 12 dependencies from the Podfile and 22 total pods installed.

[!] The `MySampleApp [Debug]` target overrides the `OTHER_SWIFT_FLAGS` build setting defined in `Pods/Target Support Files/Pods-MySampleApp/Pods-MySampleApp.debug.xcconfig'. This can lead to problems with the CocoaPods installation
    - Use the `$(inherited)` flag, or
    - Remove the build settings from the target.

error.png

解決方法

[!]の案内通り、対象の設定に$(inherited)を追加する。

手順

xcodeproj → TARGETS → Build Settings → 右上の検索窓でother_swiftとかで検索すると下のような項目がでる。
※ 特に設定してない場合は画像と違って空欄になっているはず

koumoku.png

対象スキームの右側の欄をダブルクリックすると下のような画面が開くので、
+アイコンをクリックして$(inherited)を項目に追加
inhe.png

これで設定は完了。
再度pod installするとメッセージが消えて、ライブラリがロードできるようになっていました。

説明

設定ファイルの内容を継承(inherited)して上書きしていく必要があるそうですが、
今回の場合はその継承関係が途中で切れていたため、正常に反映できていなかったようです。
参考: XCodeのBuild Settingsで、値が決まっていくルール -Qiita

3
2
0

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
3
2