我正在通过 Flutter 构建一个应用程序。 我在执行“pod install”时收到此错误消息,并且 pod 安装失败并停止。
错误信息:
[!]以下 Swift Pod 尚无法集成为静态库:
Swift pod
依赖于DKPhotoGallery
和SDWebImage
,它们不定义模块。要选择那些生成模块映射的目标(在构建为静态库时需要从 Swift 导入它们),您可以在 Podfile 中全局设置SDWebImageFLPlugin
,或者为特定依赖项指定use_modular_headers!
。:modular_headers => true
我应该在哪里设置“use_modular_headers!”在 Podfile 中?谢谢!
我尝试了解决方案。 “使用框架!”应添加到“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')
.
.
.
cocoapods 1.9 发布了一个新命令
use_frameworks! :linkage => :static
允许静态链接
那些似乎不是定义模块。 在你的 Podfile 中添加:
pod 'YOUR_PACKAGE_NAME', :modular_headers => true
将其添加到 Pod 文件中的
target
之前
use_frameworks! :linkage => :static
我遇到了同样的问题,但没有一个解决方案对我有用。
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
清除此路径的内容解决了本地环境的问题:
~/Library/Developer/Xcode/iOS DeviceSupport/
在本例中,它有文件夹
/12.5.7 (16H81)
,其中当前 Xcode 最高版本为 14.1
在 pod 文件中目标后面添加
use_modular_headers!
target 'KF6Mobile' do
use_frameworks! :linkage => :static
....