Giancarlo Marasso
Giancarlo Marasso

Reputation: 371

Firebase (4.0.0): Use of unresolved identifier FirebaseApp when installing FirebaseDatabase

This is what happens:

unresolved on Database

Then I added the Database framework

unresolved on FirebaseApp

It seems that the 2 frameworks are in mutex mode. They cannot coexist.

I have tried everything: update, install, uninstall, recreate the project, recreate the workspace. All.

May you help me. Is there a bug on last Firebase release?

Upvotes: 37

Views: 26752

Answers (14)

UndergroundFox
UndergroundFox

Reputation: 1311

This is probably too late but if you are sure your podfile is correct and your app has been building before. When this error just comes out of the blue, remember that the other thing can go wrong is your Xcode's incremental build folder.

Try this:

  1. Quite Xcode
  2. Locate your Build folder and DerivedData folder in finder
  3. Delete Build folder and DerivedData folder
  4. Rebuild via Xcode

Hopefully you'd be fine then.

Upvotes: 1

Dan Burkhardt
Dan Burkhardt

Reputation: 21

import FirebaseCore

Adding this to the top of the class resolved the issue for me.

FirebaseCore version: 6.29.0

Upvotes: 1

Likhit Garimella
Likhit Garimella

Reputation: 306

In my case it I needed to import FirebaseCore instead of import Firebase or import FirebaseRemoteConfig.

Upvotes: 4

Alexander Telegin
Alexander Telegin

Reputation: 714

For those facing the issue with RemoteConfig configuration, adding an extra import:

import FirebaseRemoteConfig

helped in my case

Upvotes: 1

Dilip Saket
Dilip Saket

Reputation: 96

Use FIRApp.configure() instead of FirebaseApp.

Upvotes: 1

Niraj
Niraj

Reputation: 1964

I had a similar issue.

Your import statement would be:

import Firebase

Make sure restart Xcode and to clean the build folder.

It's working for me & got rid of "Use of unresolved identifier FirebaseApp..." error

Update: For Swift 4.2: FirebaseApp.configure() does work. [FIRApp is renamed to FirebaseApp]

Upvotes: 78

Florian
Florian

Reputation: 11

It worked for me with

pod repo update
pod update

and then run this at the location of the pod file:

pod install

After rebuilding my app the error should be gone.

Upvotes: 1

ztredded
ztredded

Reputation: 69

I put in 'Firebase' along w/ 'Firebase/Core' in the podfile and it worked for me

Upvotes: 2

sonnet
sonnet

Reputation: 567

import FirebaseCore

Then you could use FirebaseApp.configure(). I'm using swift 4.

Upvotes: 50

Steffen
Steffen

Reputation: 161

That work today for me:

1. in Xcode 9.1

import UIKit
import Firebase
import UserNotifications
import FirebaseInstanceID
import FirebaseMessaging
import FirebaseCrash
import FirebaseAnalytics


@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {

    var window: UIWindow?


    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {

        FirebaseApp.configure()

        return true
    }

2. My PodFile

pod 'Firebase'
  pod 'Firebase/Core'
  pod 'Firebase/Database'
  pod 'Firebase/Crash'
  pod 'Firebase/RemoteConfig'
  pod 'Firebase/Storage'
  pod 'FirebaseUI', '~> 4.0'
  pod 'Firebase/Auth'
  pod 'Firebase/Messaging'

3. finale:

pod repo update
pod update

4. restart xcode:

5. press: shift-alt-command-k (in xcode)

This will delete all of the products and intermediate files in the build folder.It's different from delete derive data.

6. an clean

done

Upvotes: 5

Ali Momen Sani
Ali Momen Sani

Reputation: 842

Replace pod 'Firebase/Core' with pod 'Firebase'. Then run pod repo update.

Upvotes: 6

nzackoya
nzackoya

Reputation: 356

sudo gem install cocoapods
pod update

Upvotes: 8

Zain Ullah Muhammad
Zain Ullah Muhammad

Reputation: 519

use FIRApp.configure() instead of Firebase.configure()

Upvotes: 14

Chris Edgington
Chris Edgington

Reputation: 3256

Sounds like you might be using an older version of Firebase. Try -

pod repo update
pod update

Double check Firebase 4.0 is being installed.

Also try importing the specific modules. So instead of import Firebase use import FirebaseDatabaseor import FirebaseAuth.

Upvotes: 27

Related Questions