問題描述
Swift pod 還不能集成為靜態庫 (Swift pods cannot yet be integrated as static libraries)
我正在通過 Flutter 構建一個應用程序。我在執行“pod install”時收到此錯誤消息。並且 pod 安裝失敗並停止。
錯誤消息:
[!] 以下 Swift pod 尚無法集成為靜態庫:
Swift pod
DKPhotoGallery
依賴於不定義模塊的SDWebImage
和SDWebImageFLPlugin
。要選擇生成模塊映射的目標(在構建為靜態庫時需要從 Swift 導入它們),您可以在 Podfile 中全局設置use_modular_headers!
,或指定:modular_headers => ; true
用於特定的依賴項。我應該在哪裡設置“use_modular_headers!” 在 Podfile 中?謝謝!
參考解法
方法 1:
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') . . .
方法 2:
With cocoapods 1.9 a new command is shipped
use_frameworks! :linkage => :static
which allows static linking方法 3:
those seem are not define modules. in your Podfile add:
pod 'YOUR_PACKAGE_NAME', :modular_headers => true
方法 4:
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
(by dreamkast、dreamkast、Karsten、Amir、Rahul sharma)
參考文件