Swift pods cannot yet be integrated as static libraries

Viewed 14539

I am building a app by Flutter. I have got this error message when doing "pod install" and the pod install failed and stopped.

The error message:

[!] The following Swift pods cannot yet be integrated as static libraries:

The Swift pod DKPhotoGallery depends upon SDWebImage and SDWebImageFLPlugin, which do not define modules. To opt into those targets generating module maps (which is necessary to import them from Swift when building as static libraries), you may set use_modular_headers! globally in your Podfile, or specify :modular_headers => true for particular dependencies.

Where should I set "use_modular_headers!" in the Podfile? thanks!

4 Answers

I tried out the solution. "use_frameworks!" should be added here in 'ios/Podfile':

.
.
.
target 'Runner' do
      # Flutter Pod
    
      use_frameworks! #add here
    
      copied_flutter_dir = File.join(__dir__, 'Flutter')
      copied_framework_path = File.join(copied_flutter_dir, 'Flutter.framework')
      copied_podspec_path = File.join(copied_flutter_dir, 'Flutter.podspec')
.
.
.

With cocoapods 1.9 a new command is shipped use_frameworks! :linkage => :static which allows static linking

those seem are not define modules. in your Podfile add:

pod 'YOUR_PACKAGE_NAME', :modular_headers => true

I had the same issue but none of the solutions worked for me.

 target 'Runner' do use_frameworks! use_modular_headers!

 flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
 pod 'DKImagePickerController/PhotoGallery', :git => 'https://github.com/miguelpruivo/DKImagePickerController.git', :modular_headers => true //this is the library i was getting error.
 end
Related