32

When trying to configure XCode to work with Firebase 3, using the code in the setup docs gives me an error:

https://firebase.google.com/docs/ios/setup#add_the_sdk

import UIKit
import Contacts
import Firebase

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {

    var window: UIWindow?

    //contacts
    var contactStore = CNContactStore()


    func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
        FIRApp.configure() <-- Use of unresolved identifier 'FIRApp'
        // Override point for customization after application launch.
        return true
    }
Allen Su
  • 321
  • 1
  • 3
  • 3
  • 1
    To anyone still reading, uninstalling cocoapods and then reinstalling it and redoing everything solved the problem. – Allen Su May 22 '16 at 14:00
  • In my case I was updating an old project and my platform minimum version was set too low. Changing to `platform :ios, '9.0'` fixed it for me. – Sam Corder Jun 07 '16 at 01:08

15 Answers15

44

I think this is the correct solution:

  1. pod repo update
  2. pod update

But I had the same issue and solved it doing the following steps on the command line:

  1. pod repo update
  2. Commented the pod 'Firebase' line from my Podfile
  3. pod install (this removed the old Firebase)
  4. Added the pod 'Firebase' line again.
  5. pod install (added the new Firebase)

2nd and 3rd steps were the key I think, otherwise CocoaPods didn't try to update it. As I said maybe this could've been solved by doing pod update but now I can't go back and try again.

After all of this you should see something like: Installing Firebase (3.2.0) Installing FirebaseAnalytics (3.2.0) Installing FirebaseInstanceID (1.0.6) Installing GoogleInterchangeUtilities (1.2.1) Installing GoogleSymbolUtilities (1.1.1) Installing GoogleUtilities (1.3.1)

Lluis Gerard
  • 1,623
  • 17
  • 16
  • This should be the correct accepted answer. Thanks!! – Arunabh Das May 29 '16 at 08:20
  • I used`hoangpx's podfile`, and the first two steps at the top of this answer, and then in Xcode I had to do `Product>Clean` to get rid of the error. If you are wondering what the difference is between `pod update` and `pod install`, see here https://guides.cocoapods.org/using/pod-install-vs-update.html. Initially, I skipped #1, and #2 produced `Error installing FirebaseDatabase`. – 7stud Jun 02 '16 at 06:20
  • Can confirm i just did the shorter steps 1 and 2 option and worked for me. – James Hall Jun 14 '16 at 15:51
  • Is it necessary to add the import to each ViewController class created? – tccpg288 Feb 28 '17 at 02:28
15

I had the same error, resolved easily. Close the project. Open pod file then update from

pod 'Firebase', '>= 2.5.1'

to

pod 'Firebase/Core'
pod 'Firebase/Database'

Then open terminal, located to your pod file in project folder, enter :pod update. Make sure you see 2 lines

Installing Firebase 3.2.0 (was 2.5.1)
Installing FirebaseDatabase (3.0.1)

Then you're good to go

hoangpx
  • 470
  • 2
  • 16
11

Solve this problem like this:

import FirebaseAnalytics

Then need to replace FIRApp with FirebaseApp as FIRApp is deprecated.

Thanks.

Preetam Jadakar
  • 4,479
  • 2
  • 28
  • 58
storm
  • 111
  • 1
  • 2
8

Update your pods type in terminal

pod update

then install the pod agian, worked for me

saurabh
  • 6,687
  • 7
  • 42
  • 63
  • God! 2 days on this too, what a nightmare. Pod update and Pod install fixed everything for me too! Thx – Adrien Jun 16 '16 at 05:49
5

Try to use pod repo update and pod install again.

Politta
  • 400
  • 4
  • 10
5

I had the same problem and I resolved it like this.

pod update ...

(using only Firebase/Core and Analytics)

enter image description here

I am using xCode version 8.2.1 Hope thats will help to someone.

If the project is older and there is problem with the other pods, you can update only the pod you want: How to update a single pod without touching other dependencies

Damyan Todorov
  • 536
  • 1
  • 6
  • 17
3

If you are using ReactNative > 0.62, make sure that you put in AppDelegate.m

#import <Firebase.h>

Before:

#ifdef FB_SONARKIT_ENABLED
Elletlar
  • 3,136
  • 7
  • 32
  • 38
Gbaba
  • 41
  • 2
2

first make sure your Firebase version is 3 by use console to entering your project file and use pod update order to update your Firebase version to 3

DanieL
  • 21
  • 2
2

Try removing the pods from the podfile and then do a 'pod install'. Add the pods back and then do another 'pod install'. Clean your workspace and then build it. It took me a few tries but that ended up working for me.

kygcoleman
  • 734
  • 15
  • 25
2

I just resoved it by change Firebase.configure() to FIRApp.configure()

Chill :)

Muhammad Aamir Ali
  • 20,419
  • 10
  • 66
  • 57
2

In my case with ionic cordova plugin I had just add:

#import "FIRApp.h"

to CDVGoogleAnalytics.m file

SergioZhydecky
  • 136
  • 1
  • 2
0

All the other answers are spot on, but it sounds like you've got that stuff covered. Make sure you're using CocoaPods 1.0 (or above) and have specified use_frameworks! in your Podfile.

If you are upgrading, its worth clearing our your Pods/ directory first and possibly running pod deintegrate to get back to a zero state.

Ian Barber
  • 19,765
  • 3
  • 58
  • 58
  • It turns out I managed to finally fix it by going the good old uninstall route. Completely uninstalled cocoapods (I think I actually had two of them for some reason maybe that was the problem), installed it again, and then getting my Firebase pod again. I'm pretty sure I had the newest version of cocoapods, but hey it works now. – Allen Su May 22 '16 at 13:59
0

turns out that hoangpx answer is the right way to fix your bug, changing the pod module's name helps. But remember that when you try to run pod install it appears (or should if isn't already fixed):

Note: as of Cocoapods 1.0 ‘pod repo update’ does not happen on ‘pod install’ by default.

meaning you should do pod Firebase update first for updating to version 3.2.0 and later pod install

0

Updated cocoapods to version 1.0.x and then pod install resolved my issue

pod --version (to check your current version)

Aadi007
  • 247
  • 2
  • 5
0

In AppDelegate.m file, import this line: #import <Firebase.h> before #ifdef FB_SONARKIT_ENABLED line.

Luvnish Monga
  • 7,072
  • 3
  • 23
  • 30