我看到了这些帖子:
Error: RNFirebase core module was not found natively on iOS
RNFirebase core module was not found natively on iOS
RNFirebase core module was not found natively on iOS - Not fixed
Error message - RNFirebase core module was not found natively on iOS
没有人帮助我。我正在尝试从react-native-firebase v 5.6.0升级到v6。
我遵循了迁移指南(https://rnfirebase.io/migrating-to-v6),但是不知何故没有安装我的Pod。
如果我这样手动添加RNFBApp pod
pod 'RNFBApp', :path => '../node_modules/@react-native-firebase/app'
然后我收到此错误
[!] CocoaPods could not find compatible versions for pod "Firebase/CoreOnly":
In snapshot (Podfile.lock):
Firebase/CoreOnly (= 6.3.0)
In Podfile:
RNFBApp (from `../node_modules/@react-native-firebase/app`) was resolved to 8.2.0, which depends on
Firebase/CoreOnly (~> 6.27.0)
You have either:
* changed the constraints of dependency `Firebase/CoreOnly` inside your development pod `RNFBApp`.
You should run `pod update Firebase/CoreOnly` to apply changes you've made.
修改: 这是我的Podfile:
# Uncomment the next line to define a global platform for your project
$RNFirebaseAsStaticFramework = true
platform :ios, '11.0'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'
use_frameworks!
target 'project' do
# Uncomment the next line if you're using Swift or would like to use dynamic frameworks
#use_frameworks!
#use_modular_headers!
pod 'FBReactNativeSpec', :path => "../node_modules/react-native/Libraries/FBReactNativeSpec"
pod 'RCTRequired', :path => "../node_modules/react-native/Libraries/RCTRequired"
pod 'RCTTypeSafety', :path => "../node_modules/react-native/Libraries/TypeSafety"
pod 'FBLazyVector', :path => "../node_modules/react-native/Libraries/FBLazyVector"
pod 'React', :path => '../node_modules/react-native/'
pod 'React-Core', :path => '../node_modules/react-native/'
pod 'React-CoreModules', :path => '../node_modules/react-native/React/CoreModules'
pod 'React-Core/DevSupport', :path => '../node_modules/react-native/'
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-Core/RCTWebSocket', :path => '../node_modules/react-native/'
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 'ReactCommon/turbomodule/core', :path => "../node_modules/react-native/ReactCommon"
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 'RNCharts', :path => '../node_modules/react-native-charts-wrapper'
pod 'QBImagePickerController', :path => '../node_modules/react-native-image-crop-picker/ios/QBImagePicker/QBImagePickerController.podspec'
pod 'RNGestureHandler', :path => '../node_modules/react-native-gesture-handler'
pod 'RNImageCropPicker', :path => '../node_modules/react-native-image-crop-picker'
pod 'RNVectorIcons', :path => '../node_modules/react-native-vector-icons'
pod 'react-native-splash-screen', :path => '../node_modules/react-native-splash-screen'
pod 'react-native-netinfo', :path => '../node_modules/@react-native-community/netinfo'
pod 'Firebase'
# pod 'Firebase/Core', '~> 6.3.0'
# pod 'Firebase/Messaging'
# pod 'Firebase/Analytics'
# pod 'Firebase/DynamicLinks'
# pod 'Firebase/Messaging', '~> 6.27.0'
# FBSDK
# pod 'FBSDKCoreKit'
# pod 'FBSDKLoginKit'
# pod 'FBSDKShareKit'
# RNGestureHandler
# RNVectorIcons
pre_install do |installer|
installer.analysis_result.specifications.each do |s|
s.swift_version = '5.0' unless s.swift_version
end
end
#post_install do |installer|
# rnfirebase = installer.pods_project.targets.find { |target| target.name == 'RNFirebase' }
# rnfirebase.build_configurations.each do |config|
# config.build_settings['HEADER_SEARCH_PATHS'] = '$(inherited) ${PODS_ROOT}/Headers/Public/**'
# end
#end
use_native_modules!
end
如果我react-native run-ios
一开始就收到此消息,则认为与以下问题有关:
错误找不到以下本机模块:RNFBApp, RNFBMessaging,RNScreens。您是否忘了运行“ pod install”?
如果我不手动添加RNFBApp pod,则在pod安装过程中不会出现任何错误,但是当我在模拟器中运行该应用程序时,会得到在iOS上找不到RNFirebase核心模块错误。
此外,在package.json中,我看到以下react-native-firebase依赖项:
"@react-native-firebase/app": "^8.2.0",
"@react-native-firebase/messaging": "^7.1.4",
反应本机版本为0.61.2,所以我认为自动链接应该起作用。
我删除Podfile.lock文件和Pods文件夹,然后pod install --repo-update
没做任何更改。
编辑2:
我在Podfile中缺少2行以下的内容。添加它们使podfile起作用。
在目标“项目”做循环之前:
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'
在循环结束时:
use_native_modules!
此外,我按照文档(https://rnfirebase.io/migrating-to-v6#removing-v5-from-ios)中的建议从podfile中删除了以下几行:
pod 'Firebase/Core', '~> 6.3.0'
我删除了以下行,因为自动链接现在似乎可以正常工作:
pod 'RNFBApp', :path => '../node_modules/@react-native-firebase/app'
按照文档(https://rnfirebase.io/#allow-ios-static-frameworks)的建议,将以下行添加到pod文件的顶部以解决
目标具有传递依赖,包括静态链接 二进制文件:(FirebaseCore,FirebaseCoreDiagnostics,GoogleDataTransport, FirebaseInstallations,FirebaseMessaging和FirebaseInstanceID)
问题。
$RNFirebaseAsStaticFramework = true
当我完成全新的Pod安装时,安装成功完成,但是在模拟器中启动该应用程序后,我仍然得到在iOS上未本地找到rnfirebase核心模块错误。
文档告诉您删除RNFirebase吊舱(https://rnfirebase.io/migrating-to-v6#remove-the-rnfirebase-pod),但该应用似乎仍在寻找并且找不到它。
可能是什么问题?
谢谢