简体   繁体   中英

Build Error: (in target 'RNFBApp' from project 'Pods')

When ever I run 'npx react-native run-ios' in my terminal to build my react native project I get a build error. I have followed all the instruction on installing FireBase, but it keeps giving me an error 65 message, and says fatal error: 'FirebaseStorage/FirebaseStorage-Swift.h' file not found, #import <FirebaseStorage/FirebaseStorage-Swift.h>, and another error (in target 'RNFBApp' from project 'Pods').

The app works when I just run npx react-native start, when I don't have my FireBase storage library in my code. Such as 'import storage from "@react-native-firebase/storage";', when ever I do have it in my code it gives me an AppRegistry error when an newEventMeter error, but I think that's a symptom from my build error, so I think that is irrelevent.

I know the issue in my ios folder, and most likely in my pod file. Nothing on github or stackoverflow has helped. If anyone has any idea that would be greatly appreciated.

The libraries I installed

sudo npm i @react-native-firebase/app
sudo npm i @react-native-firebase/storage

podfile

require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'

$RNFirebaseAsStaticFramework = true
platform :ios, '12.4'
install! 'cocoapods', :deterministic_uuids => false
use_frameworks!

target 'frontendMobile' do
  config = use_native_modules!

  # Flags change depending on the env values.
  flags = get_default_flags()

  pod 'Firebase', :modular_headers => true
  pod 'FirebaseCoreInternal', :modular_headers => true
  pod 'GoogleUtilities', :modular_headers => true
  pod 'FirebaseStorage', :modular_headers => true
  pod 'FirebaseStorageInternal', :modular_headers => true
  pod 'FirebaseAppCheckInterop', :modular_headers => true
  pod 'FirebaseAuthInterop', :modular_headers => true
  pod 'FirebaseCore', :modular_headers => true
  pod 'FirebaseCoreExtension', :modular_headers => true

  use_react_native!(
    :path => config[:reactNativePath],
    # to enable hermes on iOS, change `false` to `true` and then install pods
    :hermes_enabled => flags[:hermes_enabled],
    :fabric_enabled => flags[:fabric_enabled],
    # An absolute path to your application root.
    :app_path => "#{Pod::Config.instance.installation_root}/.."
  )

  target 'frontendMobileTests' do
    inherit! :complete
    # Pods for testing
  end

  # Enables Flipper.
  #
  # Note that if you have use_frameworks! enabled, Flipper will not work and
  # you should disable the next line.
  use_flipper!()

  post_install do |installer|
    react_native_post_install(installer)
    __apply_Xcode_12_5_M1_post_install_workaround(installer)
    if ['RNFBApp', 'RNFBMessaging'].include?(target.name)
      target.add_system_framework(installer.pods_project.targets.find{|target| target.name == 'GoogleUtilities'})
      end
    if ['RNFBCrashlytics'].include?(target.name)
      target.add_system_framework(installer.pods_project.targets.find{|target| target.name == 'Fabric'})
      target.add_system_framework(installer.pods_project.targets.find{|target| target.name == 'Crashlytics'})
      end
  end
end

AppDelegate.mm

#import "AppDelegate.h"

#import <React/RCTBridge.h>
#import <React/RCTBundleURLProvider.h>
#import <React/RCTRootView.h>

#import <React/RCTAppSetupUtils.h>

#import <Firebase.h>
#if RCT_NEW_ARCH_ENABLED
#import <React/CoreModulesPlugins.h>
#import <React/RCTCxxBridgeDelegate.h>
#import <React/RCTFabricSurfaceHostingProxyRootView.h>
#import <React/RCTSurfacePresenter.h>
#import <React/RCTSurfacePresenterBridgeAdapter.h>
#import <ReactCommon/RCTTurboModuleManager.h>

#import <react/config/ReactNativeConfig.h>

static NSString *const kRNConcurrentRoot = @"concurrentRoot";

@interface AppDelegate () <RCTCxxBridgeDelegate, RCTTurboModuleManagerDelegate> {
  RCTTurboModuleManager *_turboModuleManager;
  RCTSurfacePresenterBridgeAdapter *_bridgeAdapter;
  std::shared_ptr<const facebook::react::ReactNativeConfig> _reactNativeConfig;
  facebook::react::ContextContainer::Shared _contextContainer;
}
@end
#endif

@implementation AppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
  [FIRApp configure];
  RCTAppSetupPrepareApp(application);

  RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions];

#if RCT_NEW_ARCH_ENABLED
...
...
...

I switched to an older version @react-native-firebase/app@14.10.1

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM