简体   繁体   English

错误:在 iOS 上本地找不到 RNFirebase 核心模块

[英]Error: RNFirebase core module was not found natively on iOS

I created a new app and I am trying to use react-native-firebase .我创建了一个新应用程序,我正在尝试使用react-native-firebase But I continually get this error:但我不断收到此错误:

RNFirebase core module was not found natively on iOS, ensure you have correctly included the RNFirebase pod in your projects 'Podfile' and have run 'pod install'. RNFirebase 核心模块未在 iOS 上本地找到,请确保您已将 RNFirebase pod 正确包含在项目“Podfile”中并已运行“pod install”。

See http://invertase.link/ios for the ios setup guide.有关 ios 设置指南,请参阅http://invertase.link/ios

Steps that I have done:我已经完成的步骤:

  1. yarn add react-native-firebase

  2. react-native link react-native-firebase

  3. Set up my.plist file from Google under.../myproject/ios/myproject在.../myproject/ios/myproject 下设置来自 Google 的 my.plist 文件
  4. Ran pod update after ensuring I was using Ruby 2.5.0确保我使用的是 Ruby 2.5.0 后运行pod update
  5. Ran pod install运行 pod 安装

The pod file that I am currently using is:我目前使用的 pod 文件是:

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

target 'MyProject' do
  # Uncomment the next line if you're using Swift or would like to use dynamic frameworks
  # use_frameworks!
    pod 'Firebase/Core'
    pod 'Firebase/Database'
    pod 'Firebase/Messaging'

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

end

These are the versions that I am using:这些是我正在使用的版本:

"react": "^16.3.0-alpha.1",
"react-native": "0.54.2",
"react-native-firebase": "^3.3.1",

If you don't want to manually link, you can try installing RNFirebase as a pod install directly: 如果您不想手动链接,可以尝试直接安装RNFirebase作为pod安装:

pod 'RNFirebase', :path => 'path/to/node_modules/react-native-firebase/ios'

Changing or hardcoding HEADER_SEARCH_PATHS did not help me. 更改或硬编码HEADER_SEARCH_PATHS对我没有帮助。 When the error recurs, it's not necessary to rm -rf node_modules nor delete the pod file etc, I found it useful to clear the cache. 当错误再次发生时,没有必要rm -rf node_modules也不删除pod文件等,我发现清除缓存很有用。

I always prefer not to use pods with react native, however, the react-native-firebase's instructions for the non-pop installation will not work. 我总是不喜欢使用具有本机反应的pod,但是,反应本机firebase对非pop安装的指令将不起作用。

The reason for this is the package's search paths which assumes either /pods or /firebase 原因是包的搜索路径假定为/ pods / / firebase

问题的根源

Hence, to make it link properly follow these steps: 因此,要使其正确链接,请按照以下步骤操作:

  1. download firebase sdk 下载firebase sdk
  2. make a folder directly under ios and call it Firebase, copy the frameworks needed of the sdk in that folder WITHOUT keeping the sub-folders (note, you have not entered XCode yet) 直接在ios下创建一个文件夹并将其称为Firebase,在该文件夹中复制sdk所需的框架而不保留子文件夹(注意,你还没有输入XCode)
  3. If you haven't already npm install -s react-native-firebase 如果你还没有npm install -s react-native-firebase
  4. Open XCode and drag and drop the desired frameworks to the Frameworks-folder in XCode (Eg. in my example the contents of the Analytics, Messaging and DynamicLinks folder). 打开XCode并将所需的框架拖放到XCode中的Frameworks文件夹中(例如,在我的示例中为Analytics,Messaging和DynamicLinks文件夹的内容)。 Do not copy items when asked as you already have then in the Firebase subfolder of ios: 当您在ios的Firebase子文件夹中已经有人询问时,请不要复制项目: 添加框架

  5. In XCode right-click Libraries and select "Add files to [project]". 在XCode中,右键单击“库”,然后选择“将文件添加到[项目]”。 Find RNFirebase-project in node_modules and select the RNFirebase.xcodeproj, do not "copy items" 在node_modules中找到RNFirebase-project并选择RNFirebase.xcodeproj,不要“复制项目” RN项目文件

  6. In Project/Target settings go to Linked Frameworks and Libraries. 在“项目/目标”设置中,转到“链接的框架和库”。 Find and add libRNFirebase.a 查找并添加libRNFirebase.a libRNFirebase.a

  7. In AppDelegate.m make adjustments as per the instructions from react-native-firebase, eg: import <Firebase.h> and [FIRAPP configure]; 在AppDelegate.m中根据来自react-native- import <Firebase.h> and [FIRAPP configure];的指令进行调整,例如: import <Firebase.h> and [FIRAPP configure]; in didFinishLaunchingWithOptions didFinishLaunchingWithOptions

  8. In Header Search Paths AND Framework Search Paths, add $(PROJECT_DIR)/Firebase 在页眉搜索路径和框架搜索路径中,添加$(PROJECT_DIR)/Firebase
  9. Don't forget to add you GoogleServices-Info.plist to your project 不要忘记将GoogleServices-Info.plist添加到您的项目中

I had the same problem, while trying to fix it was making my app to crash on start up. 我有同样的问题,而试图解决它是让我的应用程序在启动时崩溃。

I moved it through the terminal under the ios/AppFolder/ but the Xcode was never aware of this file. 我将它移动到ios/AppFolder/下的终端,但Xcode从未意识到这个文件。

What helped me was to open my project in Xcode. 帮助我的是在Xcode中打开我的项目。 Then left-click on my AppFolder > Add Files and then add the GoogleService-Info.plist . 然后左键单击我的AppFolder > Add Files ,然后添加GoogleService-Info.plist

I manually linked these react-native-firebase/* packages with我手动将这些 react-native-firebase/* 包与

  react-native link  @react-native-firebase/xxx

"@react-native-firebase/analytics","@react-native-firebase/app","@react-native-firebase/auth","@react-native-firebase/crashlytics","@react-native-firebase/messaging" which generated pod spec in pod and it worked. “@react-native-firebase/analytics”,“@react-native-firebase/app”,“@react-native-firebase/auth”,“@react-native-firebase/crashlytics”,“@react-native- firebase/messaging”,它在 pod 中生成了 pod 规范并且它起作用了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Flutter on IOS:致命错误:找不到模块“cloud_firestore” - Flutter on IOS: fatal error: module 'cloud_firestore' not found 找不到模块:无法解析“@aws-amplify/core” - Module not found: Can't resolve '@aws-amplify/core' 未找到模块:错误:无法解析“./Firebase” - Module not found: Error: Can't resolve './Firebase' unity Firebase on IOS lFirebaseCore is not found 报错 - Unity Firebase on IOS lFirebaseCore is not found error Firebase 错误:找不到模块:错误:包路径。 不从包中导出 - Firebase Error : Module not found: Error: Package path . is not exported from package Firebase 错误:找不到模块:错误:Package 路径。 不从 package 导出 - Firebase Error : Module not found: Error: Package path . is not exported from package 找不到模块:错误:Package 路径。 不从 package 导出 - Module not found: Error: Package path . is not exported from package 在谷歌云中运行 Apache Beam 作业时找不到错误模块 - Error module not found while running Apache beam job in google cloud Heroku 未找到模块:错误:无法解析“-/firebase-config” - Heroku Module not found: Error: Can't resolve '-/firebase-config' 找不到模块:错误:无法在 Kotlin/JS 中解析“firebase/app” - Module not found: Error: Can't resolve 'firebase/app' in Kotlin/JS
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM