20

I followed all instructions for integrating the new firebase release on ios:

  1. I downloaded the file GoogleService-Info.plist and include it in the project.

  2. I installed the framework with cocoapods

The problem is with this line:

@import Firebase;

Xcode prints this error:

"Module Firebase not found"

What is the solution?

My code :

#import "AppDelegate.h"

@import Firebase

@interface AppDelegate ()

@end

@implementation AppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    [FIRApp configure];

    // Override point for customization after application launch.
    return YES;
}

22
  • 1
    Post your code snap here. May 19, 2016 at 12:00
  • im in objective-c, what im missing?
    – N.Hicheri
    May 19, 2016 at 12:00
  • 4
    @N.Hicheri use this #import <Firebase/Firebase.h>
    – LC 웃
    May 19, 2016 at 12:02
  • 1
    Check this Firebase Doc #import <Firebase/Firebase.h>
    – TheTiger
    May 19, 2016 at 12:03
  • 1
    @N.Hicheri If you able to write [FIRApp configure]; it means your framework has imported successfully.
    – TheTiger
    May 20, 2016 at 5:03

11 Answers 11

24

I ended up fixing it by using

#import <Firebase/Firebase.h>

instead of

@import Firebase

2
  • For me this worked but I had to not use <angled brackets> but instead use "quotes" Jul 12, 2018 at 23:33
  • works for me. cordova platform rm ios and #import <Firebase/Firebase.h> Jan 31, 2020 at 19:28
13

Got the same issue on the import. My target's build settings overrode the 'Header search path' without the '$(inherited)' flag

'pod update' warns you about that.

  1. Open your target build settings
    target build settings
  1. In 'Header search paths' add a line containing $(inherited).

It solved the issue for me

Hope it helps

0
7

Its work for me in this way.

using FirebaseCore/FirebaseCore.h

Try the below code.

#import "AppDelegate.h"
#import <FirebaseCore/FirebaseCore.h>

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    // Override point for customization after application launch.
    [FIRApp configure];
    return YES;
}
2
  • for me too. Thanks, mate!
    – oskarko
    Oct 26, 2019 at 18:39
  • This worked for me. I am building Cordova app for iOS platform. Oct 28, 2021 at 16:18
3

I tried the above but sadly, nothing worked. Clean the build folder, clearing Xcode cache helped me. Try this:

  1. Quit Xcode.
  2. Delete project's temp files located at ~/Library/Developer/Xcode/DerivedData
  3. Delete ProjectName.xcworkspace
  4. Delete Podfile.lock file and Pods folder
  5. Run pod install.
  6. Open the newly created ProjectName.xcworkspace file and build.

Pay extensive attention to the 6th step. Open this newly created xcworkspace, not xcodeproj.

Original answer: https://stackoverflow.com/a/44486792/913601

1
  • I tried everything else on this page, and this is the only thing that worked -- the key for me was removing the entire Pods folder. Aug 3, 2020 at 14:56
2

I had the same problem. I found that the problem was I have three targets in Cocoapods file. And only my main one target has Firebase added. So that when I want to import Firebase to a file that is used in other targets, Xcode gives error and says Module 'Firebase' not found. This is my pods project file. One solution for me is adding Firebase pod to all targets. Or another solution is removing the file from other targets.

def common_pods
  pod 'XXX'
end

target 'myMainProject' do
  common_pods()
  pod 'Firebase/Core'
  pod 'Firebase/AdMob'
  pod 'Firebase/RemoteConfig'
  pod 'Firebase/Crashlytics'
  pod 'Firebase/Analytics'
end

target 'myExtention1' do
  common_pods()
end

target 'myextension2' do
  common_pods()
end

1

I have same issue and found solution in here: iOS - Firebase error: Use of unresolved identifier FIRApp running supplied code

Doing the following steps on the terminal 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.

1
0

There are two ways of adding the Firebase SDK to your iOS project. You can either use CocoaPods, in which case its really important to make sure your pod dependency is in the target you are using. E.g.

use_frameworks!
platform :ios, '7.0'
pod 'Firebase/Analytics'

target 'Target1' do
end
target 'Target2' do
end

There are a lot of different ways of configuring targets in CocoaPods, so your Podfile may look different. The important thing is that the target you specify is linked with the pod - in this case I have specified the Analytics pod so its available to all targets, but if I put it just in the Target1 do...end block, then it wouldn't be available in Target2.

If you're using the framework integration method, then make sure the libraries are specified in the Link Binary With Libraries section of your Build Phases tab. This should happen automatically if you drag them into a Frameworks group in Xcode.

Finally, if that doesn't work, Xcode may have cached something bad. Try opening the Product menu, hold down Option and click Clean build folder.

2
  • I tried manually linking it under the Build Phases tab and then cleaning the build folder and it still didn't work for me. Any thoughts?
    – ArielSD
    May 16, 2017 at 20:29
  • 1
    If you're just using the frameworks that should be sufficient - make sure you have the full set of frameworks required though (which should be all the ones in the directory of the zip for the service you're using)
    – Ian Barber
    May 17, 2017 at 18:24
0

I had similar issue stating that FirebaseMessaging module not found in header even though I had correct Podfile configuration.

Screenshot 1

Solution is to remove Cocoapods from project and add it again.

You can remove CocoaPods from project using this link.

Thereafter, you can add CocoaPods again using this link.

Below is snapshot for Podfile that I have used.

Screenshot 2

Below snapshot shows log on dependencies that are installed using Pods.

Screenshot 3

1
0

First check if you have $(inherited) flag in Target > Build Settings > Framework Search Paths

If you still have error, go throw these steps :

  1. Quit Xcode.
  2. Delete project's temp files located at ~/Users/YourUserName/Library(hidden one)/Developer/Xcode/DerivedData
  3. Delete ProjectName.xcworkspace
  4. Backup project's Podfile and delete Podfile.lock file and Pods folder
  5. Run pod init
  6. Replace your pervious Podfile with the new one.
  7. Finally run pod install

Now open the newly created ProjectName.xcworkspace file and build.

If you have problem in finding DerivedData location check this answer : https://stackoverflow.com/a/39495772/1572408

-2

This is lame but i fixed integration problems by adding the sources to my project instead using pods. I had to manually fix few files too.

-4

update your pods. open terminal go to your project directory and type the following command

pod update

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.