I created a flutter project and a Podfile was generated automatically. I need to add the following dependencies into my project,
pod 'GMGdtAdapter-Beta', '4.15.40.1'
pod 'GMKsAdapter-Beta', '3.3.76.1'
May I ask if I should add these two lines at the end of the auto-generated Profile? like
... ...
post_install do |installer|
installer.pods_project.targets.each do |target|
flutter_additional_ios_build_settings(target)
end
end
pod 'GMGdtAdapter-Beta', '4.15.40.1'
pod 'GMKsAdapter-Beta', '3.3.76.1'
Or if I should add them in the Runner
target like,
... ...
target 'Runner' do
use_frameworks!
use_modular_headers!
pod 'GMGdtAdapter-Beta', '4.15.40.1'
pod 'GMKsAdapter-Beta', '3.3.76.1'
flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
target 'RunnerTests' do
inherit! :search_paths
end
end
... ...
Thanks in advance!
The short answer is: You should add it inside Runner
target.
---------------
To manually add a CocoaPods dependency to an iOS Flutter project, follow these steps:
In your Flutter project, navigate to:
your_flutter_project/ios/Podfile
target 'Runner' do
blockFor example, to add SDWebImage
:
target 'Runner' do
use_frameworks!
use_modular_headers!
flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
# Add your pod here
pod 'SDWebImage', '~> 5.0'
end
pod install
After saving the Podfile:
cd ios
pod install
Sometimes it's useful to clean and rebuild your Flutter project:
flutter clean
flutter pub get
flutter run
Flutter uses CocoaPods internally, so you must not remove or modify flutter_install_all_ios_pods
.
If your pod uses use_frameworks!
, you may need to resolve conflicts if some Flutter plugins are incompatible. You can use workarounds like :modular_headers => true
or convert to static frameworks depending on the case.