In attempting to learn Firebase, I followed the steps in the IOS Quickstart section of the Firebase website. I use Cocoapods and followed the steps exactly as documented. However, "import Firebase" results in a compiler error. I don't see the Framework any where but I do see the Firebase objective C files.. . By following the manual process of downloading the zip file and adding it to the project I can make it work. However, I would like to understand what I am doing wrong.

- 2,878
- 3
- 27
- 37
7 Answers
You shouldn't need to use a Bridging Header.
The Firebase SDK uses Swift module mapping, so you'll have to let CocoaPods know.
Use this podfile:
use_frameworks! # this allows you to use import Firebase
pod 'Firebase', '>= 2.5.0'
Then you should be able to use import Firebase
in any Swift file.
Sometimes after opening from CocoaPods install, XCode can get confused. Do a Cmd+K
to clean and a Cmd+Shift+R
to rebuild. If that still is giving you errors, then restart Xcode and try the clean and build again.

- 31,526
- 6
- 67
- 82
-
Hey David - that's fine but seems not to be documented. https://www.firebase.com/docs/ios/quickstart.html – Darko Dec 26 '15 at 20:33
-
You're right, it should be in the docs. The module mapping is a newer addition so it hasn't made its way there yet. – David East Dec 26 '15 at 20:42
-
Hi David: I have the two commands as shown. I also used the 'Clean' command and restarted. But could not make it work. – Syed Tariq Dec 27 '15 at 05:13
-
In the tutorial (link in my comment) the reference to Firebase is implied. I do not see any 'import Firebase' anywhere is the code but the class is used. – Syed Tariq Dec 27 '15 at 05:16
-
Hi David: I was wrong regarding installation using Cocoapods. I opened the .xcworkspace from the console and did a 'Clean' and 'Build' as you suggested. Then 'import Firebase' did not issue a compile error. So essentially your answer is correct. Thhank you. – Syed Tariq Dec 27 '15 at 06:00
import FirebaseCore
and
FirebaseApp.configure()
These are the new documented injections into FireBase in Swift, rather than what you were using. Good day, sir.

- 113
- 3
- 7
You need to create an ObjC bridging header. There are many SO tutorials about that.

- 9,655
- 9
- 36
- 48
-
I included a bridging header but I am still getting an error. In a tutorial https://github.com/scotteg/Grocr/blob/master/Grocr/AppDelegate.swift I noticed that there is NO import to Firebase but there is a reference to the class. What else could I be missing? I am carefully looking at the code. – Syed Tariq Dec 26 '15 at 06:12
-
-
-
@Darko if there are many StackOverflow questions about it, can you link to one? – Frank van Puffelen Dec 26 '15 at 14:44
-
-
-
-
So I was having the same problem. Right now the fix is very simple, before you type import Firebase, after following the instructions, simply build your project. i.e. cmd+b, this did it for me, before doing this it does not recognize the path, no need to change the path!

- 498
- 1
- 4
- 9
-
Thanks @dherre3. After hours of attempting to get this to work, your simple procedure worked for me. – Alan Cabrera Nov 06 '16 at 16:44
I got the same problem. and i try to execute these code below in terminal, then it works for me. After change your pod file with pod 'Firebase'. Go to terminal:
$ cd yourSource
$ pod install
$ pod repo update
waiting it update for about 5 minutes. Then calling update pod
$ pod update
it will update Firebase and install some parts are lacked I think it has something wrong about the version because i saw it installed ver 2.5 and when i called pod update, i was seeing it was installing ver 3.0

- 1,573
- 18
- 14
Make sure you launched the project from "your_project_name.xcworkspace" file, instead of "your_project_name.xcodeproj" file. If not, your project won't find firebase.

- 2,236
- 3
- 26
- 48