swift - 自定义 React Native 库中的 CocoaLumberjack 依赖项
问题描述
我们的团队为 IOS 创建了一个 SDK,我已将其导入我的 react native 自定义库中。SDK 还依赖于 Swift Package CocoaLumberjack。
我在我的 podspec 中添加了“ s.dependency 'CocoaLumberjack', '~> 3.7.0' ”。当我将我的库添加到反应本机应用程序并运行pod install时,我收到如下错误:
The following Swift pods cannot yet be integrated as static libraries:
The Swift pod `react-native-sdk` depends upon `CocoaLumberjack`, which does 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.
我的应用程序 pod 文件如下:
require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'
platform :ios, '11.0'
target 'SdkExample' do
config = use_native_modules!
use_react_native!(:path => config["reactNativePath"])
pod 'react-native-sdk', :path => '../..'
# Enables Flipper.
#
# Note that if you have use_frameworks! enabled, Flipper will not work and
# you should disable these next few lines.
use_flipper!({ 'Flipper' => '0.80.0' })
post_install do |installer|
flipper_post_install(installer)
end
end
我的自定义库的 podspec 是这样的:
require "json"
package = JSON.parse(File.read(File.join(__dir__, "package.json")))
Pod::Spec.new do |s|
s.name = "react-native-sdk"
s.version = package["version"]
s.summary = package["description"]
s.homepage = package["homepage"]
s.license = package["license"]
s.authors = package["author"]
s.platforms = { :ios => "11.0" }
s.source = { :git => "https://github.com/ankushss/react-native-sdk.git", :tag => "#{s.version}" }
s.source_files = "ios/**/*.{h,m,mm,swift}"
s.dependency "React-Core"
s.dependency 'CocoaLumberjack', '~> 3.7.0'
s.vendored_framework = 'ios/CustomFramework.framework'
end
请帮助我。
解决方案
推荐阅读
- typescript - 如何动态加载具体实现并参数化对象创建?
- javascript - 在移动设备上更改 DIV 的 id
- node.js - Express Server 不会在 Mac 上解决 Promise
- python - 403 Forbidden while making ajax request to endpoint in Django
- python - 当我无权访问或没有可用信息时,有没有办法跳过 URL(Json 文件)
- python - 如何使用 lxml 解析以 iso-8859-1 编码的 xml 文件?
- c# - 我想用c# ITEXTSHARP 5.5.13.2生成一个两层的PDF文件,怎么生成呢?
- javascript - 链接到没有 id 属性的页面位置
- python - 如何替换beautifulsoup上不需要的文字
- bash - 将语音标记中的任何文本从一个文件保存到另一个文件的方法