在 Swift 中使用 CocoaPods 中的静态库对于 Realm 失败
Using static libraries in Swift with CocoaPods fails for Realm
从 Xcode 9 开始,可以通过省略 Podfile 中的 use_frameworks!
标志来使用静态库。但是,当与 Pod RealmSwift
一起使用时,这会导致以下错误:
[!] The following Swift pods cannot yet be integrated as static libraries:
The Swift pod `RealmSwift` depends upon `Realm`, 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.
遗憾的是,建议的 use_modular_headers!
解决方案不起作用。
我尝试过的其他事情包括:
- 使用最新的 Realm 版本 (3.15.0)
- 使用 Objective C version and add Swift support, this won't build and give a module not found error in the RLMSupport.swift 文件。
- 为 Objective C 版本添加桥接头。
- 无尽的清理、重建、Xcode 重新启动和派生数据文件夹清理。
最好不要绕过 CocoaPods 并以单独的方式安装此依赖项,因为这会使更新过程更加复杂。我希望有一个适用于 CocoaPods、Realm 和 Swift 的解决方案。
我做了以下工作:
pod 'RealmSwift', '~> 3.17', :modular_headers => true
pod 'Realm', '~> 3.17', :modular_headers => true
据我所知添加 use_modular_headers!到 Podfile 作品的顶部。
据我所知,将 s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES' } 添加到 .podspec 是行不通的。 (Cocoapods 1.6.0-beta.2)
示例:
target 'Opportunity' do
use_modular_headers!
end
我不明白为什么它不起作用。我遇到了同样的问题,我在 podfile 中按照以下方式添加了 use_modular_headers!
,它起作用了。
target 'Pick Up Lines' do
use_modular_headers!
pod 'RealmSwift'
end
顺便说一句,在进行任何操作之前,请确保将项目的部署目标设置为 11.0。
从 Xcode 9 开始,可以通过省略 Podfile 中的 use_frameworks!
标志来使用静态库。但是,当与 Pod RealmSwift
一起使用时,这会导致以下错误:
[!] The following Swift pods cannot yet be integrated as static libraries:
The Swift pod `RealmSwift` depends upon `Realm`, 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.
遗憾的是,建议的 use_modular_headers!
解决方案不起作用。
我尝试过的其他事情包括:
- 使用最新的 Realm 版本 (3.15.0)
- 使用 Objective C version and add Swift support, this won't build and give a module not found error in the RLMSupport.swift 文件。
- 为 Objective C 版本添加桥接头。
- 无尽的清理、重建、Xcode 重新启动和派生数据文件夹清理。
最好不要绕过 CocoaPods 并以单独的方式安装此依赖项,因为这会使更新过程更加复杂。我希望有一个适用于 CocoaPods、Realm 和 Swift 的解决方案。
我做了以下工作:
pod 'RealmSwift', '~> 3.17', :modular_headers => true
pod 'Realm', '~> 3.17', :modular_headers => true
据我所知添加 use_modular_headers!到 Podfile 作品的顶部。
据我所知,将 s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES' } 添加到 .podspec 是行不通的。 (Cocoapods 1.6.0-beta.2)
示例:
target 'Opportunity' do
use_modular_headers!
end
我不明白为什么它不起作用。我遇到了同样的问题,我在 podfile 中按照以下方式添加了 use_modular_headers!
,它起作用了。
target 'Pick Up Lines' do
use_modular_headers!
pod 'RealmSwift'
end
顺便说一句,在进行任何操作之前,请确保将项目的部署目标设置为 11.0。