LoginSignup
27
28

More than 5 years have passed since last update.

CocoaPodsがなんか上手く行かなかったらやること3つ

Last updated at Posted at 2016-01-30

CocoaPodsがなんか上手く行かなかったらやること3つ

あーだめだ。なんかわからんが全然うまく行かねぇ。って時にやることメモ。

その1. cleanビルド

基本ですね

ちなみに、Productメニューを開いている際にoptionキーを押すと、Derived Dataごと消せる、「Clean Build Folder...」に変化します。

その2. とにかく一旦リセット

pod install すると生成される以下のファイルを消して再度実行してみる

$ rm -rf hogefuga.xcworkspace/
$ rm Podfile.lock
$ rm -rf Pods/

2016/01/31 追記:
各ターゲットのGeneral > Linked Frameworks and LibrariesのPods.frameworkも削除したほうがいいっぽい。

.xcodeproj内にも以前のターゲット状態を元にした情報が残ってるとかなんでしょうかね。うーん。

その3. Project設定のConfigurationsとPodfileと見比べてみる

Extensionがある場合など、ターゲット毎にライブラリを指定していると、Configurationsがごっちゃごちゃになっていたりする。
例えば、Podfileを以下のような感じで書いていたとすると…

platform :ios, '8.0'
use_frameworks!

target:keyboard, :exclusive => true do
    pod 'HogeLibraryA'
end

target:keyboardextension, :exclusive => true do
    pod 'HogeLibraryB'
end

以下のように、Project>Info>Configurations が Pods-<target名>.debug / Pods-<target名>.releaseとなっているのが正解らしい。

ライブラリを指定していないターゲットは、素直に Pods.debug / Pods.release が設定されるっぽい。

自分の場合、pod installで以下のエラーが出たりしてハマったものの、

[!] CocoaPods did not set the base configuration of your project because your project already has a custom config set.

その後手動で上記画像のようなConfigurationsに設定し直すと、ビルドが通った。
(その後、pod installし直すと、上記のエラーがなくなった。手動でやってみた設定も上書きされることはなかった。)

27
28
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
27
28