【即解決】sandbox is not in sync with the Podfile.lockエラーの対処方法

【即解決】sandbox is not in sync with the Podfile.lockエラーの対処方法

iOSのPods関連で詰まったので解決方法をまとめました。

エラー内容

The sandbox is not in sync with the Podfile.lock.
Run 'pod install' or update your CocoaPods installation.

サンドボックスがPodfile.lockと同期していません。 pod install'を実行するか、CocoaPodsのインストールを更新してください。

Podsの依存関係が正しく同期されていないときに発生するみたいです。

解決方法

解決方法としては、Podfile.lockとpubspec.lockを削除、podを再インストールです。

以下のコマンドにまとめました。

% rm -rf ios/Pods ios/Podfile.lock pubspec.lock \
  && rm -rf ~/Library/Developer/Xcode/DerivedData \
  && cd ios && pod cache clean --all && pod install --repo-update \
  && cd .. &&  fvm flutter clean && fvm flutter pub get

ポイント

  • pod cache clean --all でCocoaPodsのキャッシュをクリーン
  • rm -rf ~/Library/Developer/Xcode/DerivedData でXcodeのビルドキャッシュと一時ファイル(Derived Data)を削除

再度Xcodeを立ち上げて、ビルドすればOKです。

記事を書いた人

Matsuura

エンジニア

Matsuura

Anycloudでエンジニアしてます!主にFlutter・Typescript