5

I know there has been plenty of discussions on the topic, but no answer helped to resolve the bug for me

Terminating app due to uncaught exception 'com.firebase.core', reason: 'Default app has already been configured.'

I have tried with :

   - (BOOL)application:(UIApplication*)application didFinishLaunchingWithOptions:(NSDictionary*)launchOptions
    {
        if ([FIRApp defaultApp] == nil) {
            [FIRApp configure];
        }

        self.viewController = [[MainViewController alloc] init];
        return [super application:application didFinishLaunchingWithOptions:launchOptions];
    }

@end

the default app should configure only if nil. this is not working though. What seems to be the problem?

this is my Podfile :

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

target 'com.notificationTest.fcm' do
  # Uncomment the next line if you're using Swift or would like to use dynamic frameworks
  use_frameworks!

   # Pods for com.notificationTest.fcm
   pod 'Firebase/Core'
   pod 'Firebase/Messaging'

end
Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807

1 Answers1

2

First, check whether you have implemented FirebaseApp.configure() accidentally twice in your project

or try below

In AppDelegate.swift override a following method:

override init() { FirebaseApp.configure() } 

In your ViewController.swift's viewDidLoad() method, write this code:

if FirebaseApp.app() == nil { FirebaseApp.configure()}

[shared from another language swift ]