Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot Import Firebase Into Swift Class

I am totally new to Firebase and building iOS apps. In Xcode 7, I am trying to import Firebase into my Swift class. In a swift file, I have typed "import Firebase".

I am getting an error that says

"No such module 'Firebase'"

Any help would be greatly appreciated.

like image 651
Will Jackson Avatar asked Dec 11 '15 03:12

Will Jackson


2 Answers

For me it was this:

The Framework is called FirebaseAnalytics now and not Firebase.

The official documentation even has this wrong.

So after installing with CocoaPods (Firebase version 3.4.0) this works:

import FirebaseAnalytics 
like image 131
Ole Avatar answered Oct 02 '22 23:10

Ole


There are two ways to install Firebase: manually, and with CocoaPods.

I recommend using CocoaPods. In your Podfile, make sure you specify use_frameworks!:

platform :ios, "9.0" use_frameworks!  target 'MyProject' do  pod 'Firebase' end 

Then after you pod install and open the MyProject.xcworkspace, you should be able to use import Firebase.

edit by Jay:

If you are targeting OS X your pod file may look more like this

platform :osx, '10.10' use_frameworks!  target 'MyProject' do   pod 'FirebaseOSX', '>= 2.4.2' end 
like image 35
David East Avatar answered Oct 03 '22 01:10

David East