使用 use_frameworks!在一个反应​​原生项目上

Posted

技术标签:

【中文标题】使用 use_frameworks!在一个反应​​原生项目上【英文标题】:Use use_frameworks! on a reactnative project 【发布时间】:2020-10-12 09:09:39 【问题描述】:

我的 podfile 包含来自 node_modules 上 reactnative 的静态库以及第三方 podspec,例如 Folly.podspec、glog.podspec、DoubleConversion.podspec 和动态 swift 库

当我尝试执行项目时,第三方 podspecs 出现错误 未找到双转换/双转换.h'文件

这是我的 podfile:

   platform :ios, '10.0'
  require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'

   #sdk id libs
  source 'https://gitlab-repoxxxxxxxf.fr/dosn/xxxx.git'
  source 'https://github.com/CocoaPods/Specs.git'


 target 'MyProject' do
 use_frameworks!
 # Pods for DigiDrive
 pod 'React', :path => '../node_modules/react-native/'
 pod 'React-Core', :path => '../node_modules/react-native/React'
 pod 'React-DevSupport', :path => '../node_modules/react-native/React'
 pod 'React-RCTActionSheet', :path => '../node_modules/react-native/Libraries/ActionSheetIOS'
pod 'React-RCTAnimation', :path => '../node_modules/react-native/Libraries/NativeAnimation'
pod 'React-RCTBlob', :path => '../node_modules/react-native/Libraries/Blob'
pod 'React-RCTImage', :path => '../node_modules/react-native/Libraries/Image'
pod 'React-RCTLinking', :path => '../node_modules/react-native/Libraries/LinkingIOS'
pod 'React-RCTNetwork', :path => '../node_modules/react-native/Libraries/Network'
pod 'React-RCTSettings', :path => '../node_modules/react-native/Libraries/Settings'
pod 'React-RCTText', :path => '../node_modules/react-native/Libraries/Text'
pod 'React-RCTVibration', :path => '../node_modules/react-native/Libraries/Vibration'
pod 'React-RCTWebSocket', :path => '../node_modules/react-native/Libraries/WebSocket'

pod 'React-cxxreact', :path => '../node_modules/react-native/ReactCommon/cxxreact'
pod 'React-jsi', :path => '../node_modules/react-native/ReactCommon/jsi'
pod 'React-jsiexecutor', :path => '../node_modules/react-native/ReactCommon/jsiexecutor'
pod 'React-jsinspector', :path => '../node_modules/react-native/ReactCommon/jsinspector'
pod 'yoga', :path => '../node_modules/react-native/ReactCommon/yoga'

pod 'DoubleConversion', :podspec => '../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec'
pod 'glog', :podspec => '../node_modules/react-native/third-party-podspecs/glog.podspec'
pod 'Folly', :podspec => '../node_modules/react-native/third-party-podspecs/Folly.podspec'

pod 'RNVectorIcons', :path => '../node_modules/react-native-vector-icons'



pod 'react-native-simple-toast', :path => '../node_modules/react-native-simple-toast'
#sdk id libs
pod 'IMPORTANTLIB'

target 'MyProjectTests' do
inherit! :search_paths
# Pods for testing
end

use_native_modules!
end
pre_install do |installer|
Pod::Installer::Xcode::TargetValidator.send(:define_method, 
 :verify_no_static_framework_transitive_dependencies) 
 end
target 'MyProject-tvOS' do
 # Pods for DigiDrive-tvOS

target 'MyProject-tvOSTests' do
inherit! :search_paths
# Pods for testing
end


end

我该如何解决这个问题?

【问题讨论】:

【参考方案1】:

我只是做了更多的搜索,我知道 react native 0.60 版本不支持使用 use_frameworks!,所以我不得不传递到最后一个 react native 版本:0.63.0 但问题是几个版本的库有在 reactNative 上进行更改

【讨论】:

以上是关于使用 use_frameworks!在一个反应​​原生项目上的主要内容,如果未能解决你的问题,请参考以下文章

iOS 中的 use_framework 错误

没有 use_frameworks 就无法安装 Swift cocoapod!找不到模块 swift.h 文件

如何删除 use_frameworks!并继续在 Objective-C 项目中使用 swift pod?

Swift 桥接头文件不适用于 use_frameworks

Podfile 中的 use_frameworks 问题

RestKit 编译失败,cocoapods use_frameworks for swift