设置无法响应本地Firebase?

时间:2019-10-16 19:46:45

标签: javascript firebase react-native react-native-ios react-native-firebase

我有一个React Native项目,我想使用React Native Firebase, 我只是遵循所有installation Docs在IOS中进行设置, 但是每次我构建项目时,都会出现此错误

  

找不到“ RNFirebaseUtil.h”文件

在此路径

  

/Volumes/App/node_modules/react-native-firebase/ios/RNFirebase/functions/RNFirebaseFunctions.m

在XCode中

Path

那我该如何解决这个问题?

 "dependencies": {
    "firebase-admin": "^8.1.0",
    "firebase-functions": "^3.0.1",
    "react": "16.8.6",
    "react-native": "0.59.8",
    "react-native-firebase": "5.3.1",
  }

Podfile

# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'

target 'App' do
  # Comment the next line if you don't want to use dynamic frameworks
  use_frameworks!

  # Pods for App
    pod 'RNFirebase', :path => '../node_modules/react-native-firebase/ios'

# Required by RNFirebase
  pod 'Firebase/Core', '~> 6.5.0'

# # [OPTIONAL PODS] - comment out pods for firebase products you won't be using.

  pod 'Firebase/Auth', '~> 6.5.0'
  pod 'Firebase/Database', '~> 6.5.0'
  pod 'Firebase/Functions', '~> 6.5.0'
  pod 'Firebase/Storage', '~> 6.5.0'


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

end

target 'App-tvOS' do
  # Comment the next line if you don't want to use dynamic frameworks
  use_frameworks!

  # Pods for App-tvOS

  target 'App-tvOSTests' do
    inherit! :search_paths
    # Pods for testing
  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/Headers/Public/**'
  end
end

end

2 个答案:

答案 0 :(得分:0)

好像您的版本不匹配。如果您使用的是react-native-firebase 5.3.1(来自package.json),则应在此处查找ios SDK版本:

https://rnfirebase.io/docs/v5.x.x/releases/v5.3.x#iOS---Update-Firebase-SDKs

还与5.3.1 rnf和.59.8 rn不匹配。您应该为该rn版本使用5.5.x rnf。看到这里:

https://rnfirebase.io/docs/v5.x.x/getting-started#Supported-versions---React-Native-/-Firebase

如果要将react-native-firebase从5.3.x升级到5.5.x,请确保还升级SDK。因此,您可以通过以下网址更新您的广告连播:

https://rnfirebase.io/docs/v5.x.x/releases/v5.5.x#iOS---Update-Firebase-SDKs

答案 1 :(得分:0)

对我有用的是

  • 1。在所有firebase软件包上运行npm卸载,然后重新安装
  • 2。在ios文件夹中运行“ pod更新”,
    1. 通过按住Command + Option + Shift + K来清理xcode构建文件夹,
    1. 再次构建项目。