0

I'm trying to export an application for IOS, but when I add the firebase library to the project, when exporting for IOS I get an error BUILD FAILED.

I've already followed the official documentation, I've even followed several tutorials but the errors are the same.

Build in XCODE the errors are: Could not build module 'os_workgroup' CABASE - Could not build module 'CoreFoundation' CFNETWORK - Could not build module 'CoreFoundation' CFStream - Could not build module 'Dispatch' CGBase - Could not build module 'CoreFoundation' CLErrorDomain - Could not build module 'Foundation' CoreImageDefines - Could not build module 'CoreGraphics' CTFontTraits - Could not build module 'CoreFoundation' CVBase - Could not build module 'CoreFoundation' dispatch - Could not build module 'os_workgroup' EAGL - Could not build module 'Foundation' Foundation - Could not build module 'CoreFoundation' ImageIOBase - Could not build module 'CoreFoundation' IOSurfaceBase - Could not build module 'CoreFoundation' main - Could not build module 'UIKit' module - Redefinition of module 'Firebase' MTLTypes - Could not build module 'Foundation' NSAttributeString - Could not build module 'Foundation' NSFileProviderDomain - Could not build module 'Foundation' NSString+UserNotifications - Could not build module 'Foundation' React-Core-umbrella - Could not build module 'UIKit' SecBase - Could not build module 'CoreFoundation' UIKit - Could not build module 'Foundation' vecLibTypes - Could not build module '_Builtion_intrinsics' Yoga-umbrella - Could not build module 'UIKit'

I removed the firebase library and tried to export to both platforms and everything worked.

I removed the DerivedData file, pod file and node_module file and reinstalled everything and it was the same.

the files podfile, AppDelegate (#import <Firebase.h>) have the same settings as explained in the documentation, i try to change to #import 'Firebase.h' but is the same.

My info

System: OS: macOS 13.1 CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz Memory: 1.85 GB / 32.00 GB Shell: 5.8.1 - /bin/zsh Binaries: Node: 19.2.0 - ~/.nvm/versions/node/v19.2.0/bin/node Yarn: Not Found npm: 9.2.0 - ~/.nvm/versions/node/v19.2.0/bin/npm Watchman: 2023.01.09.00 - /usr/local/bin/watchman Managers: CocoaPods: 1.11.3 - /usr/local/bin/pod SDKs: iOS SDK: Platforms: DriverKit 22.2, iOS 16.2, macOS 13.1, tvOS 16.1, watchOS 9.1 Android SDK: Not Found IDEs: Android Studio: 2021.3 AI-213.7172.25.2113.9123335 Xcode: 14.2/14C18 - /usr/bin/xcodebuild Languages: Java: 11.0.17 - /usr/bin/javac npmPackages: @react-native-community/cli: Not Found react: 18.1.0 => 18.1.0 react-native: 0.70.6 => 0.70.6 react-native-macos: Not Found npmGlobalPackages: react-native: Not Found

Any suggestion? Can you help?

0

1 Answer 1

1

Install @react-native-firebase/app and @react-native-firebase/messaging.

Open Podfile in ios diectory and add these lines:

pod 'Firebase', :modular_headers => true
pod 'FirebaseCoreInternal', :modular_headers => true
pod 'GoogleUtilities', :modular_headers => true
pod 'FirebaseCore', :modular_headers => true

in between

flags = get_default_flags()

and

use_react_native!(

Then, delete podfile.lock.

In your terminal inside your project root directory, run the following commands:

cd ios
pod deintegrate
pod cache clean --all
npm cache verify
yarn cache clean
pod install --repo-update

Next, clean build folder under XCode -> Product -> Clean Build Folder.

Run your app once from within XCode. You can then subsequently run your app from the terminal.

=====================

If for some reason you encounter this error

"No Firebase App '[DEFAULT]' has been created - call firebase.initialzeApp()"

open AppDelegate.mm add and this

#import <Firebase.h>

below

#import <React/RCTRootView.h>

Search for a block of code containing didFinishLaunchingWithOptions and add the code below at the beginning of the code block

if ([FIRApp defaultApp] == nil) {
  [FIRApp configure];
}

So, you would have something like this

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
  # Firebase configuration
  if ([FIRApp defaultApp] == nil) {
    [FIRApp configure];
  }
  
  # rest of the code below which you shouldn't touch 
  # unless you absolutely know what you are doing
  ...

This should send the error packing.

Cheers!!!

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.