LoginSignup
9
2

More than 5 years have passed since last update.

FlutterでiOSのCocoaPodsでライブラリ管理する

Last updated at Posted at 2017-10-20

最新のFlutterでは、この記事にあるような対応をしなくても動くかも? 試して動かなかったときに使ってください。

FlutterでiOSのプラットフォーム側コードを書く際に、各種ライブラリを使うことがある。

その場合は ios/Podfile に追加する。

target 'Runner' do
  # Uncomment this line if you want to use Swift in your app.
  # Note that some Flutter plugins are not compatible with use_frameworks!
  # use_frameworks!

  # Pods for Runner
  pod 'TwitterCore'
  pod 'TwitterKit'

  ...

上記の例では Twitter の SDK を追加している。

flutter runflutter build のコマンドの1ステップとして pod install が実行される。

なお、pod update したい場合は以下のようにする。

cd ios/
FLUTTER_FRAMEWORK_DIR=/path/to/flutter/bin/cache/artifacts/engine/ios/ pod update

Flutter本体が、ローカルパスにある依存Frameworkなので、そこのパスを環境変数 FLUTTER_FRAMEWORK_DIR で指定する必要がある。

9
2
1

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