1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

【CocoaPods】CocoaPodsとActiveSupportの特定バージョンの互換性問題を解決!

Last updated at Posted at 2024-02-19

はじめに

この記事では、Flutterでアプリ開発をしている際に、CocoaPodsの特定バージョンとActiveSupportのバージョンとの間で発生した互換性の問題とその解決策について紹介します。
最新のCocoaPodsではこの問題が解決されている可能性がありますが、同様の問題に直面した場合の参考にしてください。

環境

  • CocoaPods 1.13.0
  • Xcode 15.0
  • Ruby 3.2.2 (rbenvを使用して管理)
  • ActiveSupport 7.1.3

問題の発生

CocoaPodsのバージョン1.13.0をインストールした後、pod --versionを実行すると、以下のようなエラーメッセージが表示されました。

/Users/****/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/activesupport-7.1.3/lib/active_support/core_ext/array/conversions.rb:108:in `<class:Array>': undefined method `deprecator' for ActiveSupport:Module (NoMethodError)

  deprecate to_default_s: :to_s, deprecator: ActiveSupport.deprecator
                                                          ^^^^^^^^^^^

原因

こちらのCocoaPodsのIssueによると、こんなことが書かれていました。

activesupport 7.1.0 was released today (5.10.2023) and it breaks cocoapods entirely. If you update or install cocoapods, from this day, gem will install newest activesupport (7.1.0). cocoapods-core deasn't have strict version of it

s.add_runtime_dependency 'activesupport', '>= 5.0', '< 8'

If cocoapods install with activesupport 7.1.0 then any cocoapods command faile:

どうやら、activesupportのバージョン7.1.0がインストールされた状態でCocoaPodsを使用すると、互換性の問題が発生してしまい、どのCocoaPodsコマンドも失敗するみたいです。
この問題はactiveSupport 7.1.3でも同様に発生し、CocoaPodsのコマンドが正常に動作しなくなりました。

解決方法

この問題を解決するためには、activesupportのバージョンを7.1.0より前のバージョンにダウングレードする必要があります。
そのため、activeSupportのバージョン7.1.3をアンインストールし、互換性のあるバージョンである7.0.8をインストールしました。これにより、pod --versionが正常に動作し、CocoaPodsのバージョン1.13.0が表示されるようになりました。

sudo gem uninstall activesupport -v 7.1.3
sudo gem install activesupport -v 7.0.8
pod --version
1.13.0
1
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
1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?