0

Hello I configured firebase for my ios application.

But I see bunch of notes from terminal like this:

Prepare packages

Computing target dependency graph and provisioning inputs

Create build description
Build description signature: 5b4e366011110c238ef7eb0e2f1dc896
Build description path: /Users/ali/Library/Developer/Xcode/DerivedData/Cypien-fzcypiyubvmmrxeseqhayuvqdhfm/Build/Intermediates.noindex/XCBuildData/5b4e366011110c238ef7eb0e2f1dc896-desc.xcbuild

note: Building targets in dependency order
note: Removed stale file '/Users/ali/Library/Developer/Xcode/DerivedData/Cypien-fzcypiyubvmmrxeseqhayuvqdhfm/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/fmt.build/Script-46EB2E0001F240.sh'
....

But still not work for me I remove firebase dependencies everything works well.

This is my podfile:

target 'Cypien' do
  config = use_native_modules!
  use_frameworks! :linkage => :static # for Firebase
  $RNFirebaseAsStaticFramework = true # for Firebase

  # 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 'FirebaseCore', :modular_headers => true
  use_react_native!(
    :path => config[:reactNativePath],
    # Hermes is now enabled by default. Disable by setting this flag to false.
    # Upcoming versions of React Native may rely on get_default_flags(), but
    # we make it explicit here to aid in the React Native upgrade process.
    :hermes_enabled => flags[:hermes_enabled],
    :fabric_enabled => flags[:fabric_enabled],
    # Enables Flipper.
    #
    # Note that if you have use_frameworks! enabled, Flipper will not work and
    # you should disable the next line.
    #:flipper_configuration => flipper_config,
    # An absolute path to your application root.
    :app_path => "#{Pod::Config.instance.installation_root}/.."
  )

  • App Delegate file
#import <Firebase.h>
...
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
  if ([FIRApp defaultApp] == nil) { [FIRApp configure]; } // for Firebase
  self.moduleName = @"Cypien";
  // You can add your custom initial props in the dictionary below.
  // They will be passed down to the ViewController used by React Native.
  self.initialProps = @{};
  bool didFinish=[super application:application didFinishLaunchingWithOptions:launchOptions];
  [RNSplashScreen show];  // here 
  return didFinish;
}

Package.json:

    "react": "18.2.0",
    "react-native": "0.71.11",
    "@react-native-firebase/app": "^15.6.0",
"@react-native-firebase/messaging": "^15.6.0",


I tried this commands:

  • pod install --repo-update
  • pod install
  • pod deintegrate
  • Removed podfile
  • Cleaned build from xcode
  • Restarted my computer
Akif Kara
  • 442
  • 6
  • 14

1 Answers1

0

Try the below things:

first of all delete the node_modules, pods, podfile.lock then install

npm install --save @react-native-firebase/app

then install the pods

cd ios 
pod install

Add the GoogleService-Info.plist file properly. Take a reference from here

To do this, open your /ios/{projectName}/AppDelegate.mm file (or AppDelegate.m if on older react-native), and add the following:

At the top of the file, import the Firebase SDK right after '#import "AppDelegate.h"':

#import <Firebase.h>

Within your existing didFinishLaunchingWithOptions method, add the following to the top of the method:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
  // Add me --- \/
  [FIRApp configure];
  // Add me --- /\
  // ...
}

podfile

config = use_native_modules!
  flipper_config = FlipperConfiguration.enabled(["Debug"])

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

  pod 'Firebase', :modular_headers => true
  pod 'FirebaseCore', :modular_headers => true
  pod 'FirebaseCoreInternal', :modular_headers => true
  pod 'FirebaseCoreExtension', :modular_headers => true
  pod 'FirebaseInstallations', :modular_headers => true
  pod 'GoogleDataTransport', :modular_headers => true
  pod 'GoogleUtilities', :modular_headers => true
  pod 'nanopb', :modular_headers => true

  use_react_native!(
    :path => config[:reactNativePath],
    # Hermes is now enabled by default. Disable by setting this flag to false.
    # Upcoming versions of React Native may rely on get_default_flags(), but
    # we make it explicit here to aid in the React Native upgrade process.
    :hermes_enabled => flags[:hermes_enabled],
    :fabric_enabled => flags[:fabric_enabled],
    # Enables Flipper.
    #
    # Note that if you have use_frameworks! enabled, Flipper will not work and
    # you should disable the next line.
    :flipper_configuration => flipper_config,
    # An absolute path to your application root.
    :app_path => "#{Pod::Config.instance.installation_root}/.."
  )

Package.json:

"react": "18.2.0",
"react-native": "0.71.8",
"@react-native-firebase/app": "^16.4.6",
"@react-native-firebase/crashlytics": "^16.4.6",
"@react-native-firebase/messaging": "^16.4.6",
Nensi Kasundra
  • 1,980
  • 6
  • 21
  • 34
  • I tried this but gives The Swift pod `FirebaseCoreInternal` depends upon `GoogleUtilities`, which does not define modules. To opt into those targets generating module maps (which is necessary to import them from Swift when building as static libraries), you may set `use_modular_headers!` globally in your Podfile, or specify `:modular_headers => true` for particular dependencies. error when I pod install – Akif Kara Aug 24 '23 at 13:43
  • so for that, you have to add the GoogleUtilities in podfile. Check the edited answer for podfile code. Let me know if still you face any issues. – Nensi Kasundra Aug 25 '23 at 05:26
  • I tried to add these pods: pod 'Firebase', :modular_headers => true pod 'FirebaseCore', :modular_headers => true pod 'GoogleUtilities', :modular_headers => true. Maybe it's not compatible with newest react native versions. (I use 0.71) – Akif Kara Aug 25 '23 at 07:50
  • By the way I followed this link for adding pods: https://stackoverflow.com/questions/72289521/swift-pods-cannot-yet-be-integrated-as-static-libraries-firebasecoreinternal-lib/73240013#comment135692083_73240013 – Akif Kara Aug 25 '23 at 07:51
  • yes, I'm using "react": "18.2.0", "react-native": "0.71.8", – Nensi Kasundra Aug 25 '23 at 10:14
  • It's working fine with above firebase version – Nensi Kasundra Aug 25 '23 at 10:15