Swift pod 尚无法集成为静态库

问题描述 投票:0回答:7

我正在通过 Flutter 构建一个应用程序。 我在执行“pod install”时收到此错误消息,并且 pod 安装失败并停止。

错误信息:

[!]以下 Swift Pod 尚无法集成为静态库:

Swift pod

DKPhotoGallery
依赖于
SDWebImage
SDWebImageFLPlugin
,它们不定义模块。要选择那些生成模块映射的目标(在构建为静态库时需要从 Swift 导入它们),您可以在 Podfile 中全局设置
use_modular_headers!
,或者为特定依赖项指定
:modular_headers => true

我应该在哪里设置“use_modular_headers!”在 Podfile 中?谢谢!

flutter cocoapods
7个回答
32
投票

我尝试了解决方案。 “使用框架!”应添加到“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')
.
.
.

13
投票

cocoapods 1.9 发布了一个新命令

use_frameworks! :linkage => :static
允许静态链接


5
投票

那些似乎不是定义模块。 在你的 Podfile 中添加:

pod 'YOUR_PACKAGE_NAME', :modular_headers => true

2
投票

将其添加到 Pod 文件中的

target

之前
use_frameworks! :linkage => :static

1
投票

我遇到了同样的问题,但没有一个解决方案对我有用。

 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

0
投票

清除此路径的内容解决了本地环境的问题:

~/Library/Developer/Xcode/iOS DeviceSupport/

在本例中,它有文件夹

/12.5.7 (16H81)
,其中当前 Xcode 最高版本为 14.1

感谢: https://developer.apple.com/forums/thread/53202


-1
投票

在 pod 文件中目标后面添加

use_modular_headers!

target 'KF6Mobile' do
  use_frameworks! :linkage => :static
    ....

参考:https://blog.cocoapods.org/CocoaPods-1.5.0/

© www.soinside.com 2019 - 2024. All rights reserved.