can not import firebase into my swift project

swift import firebase sdk

1249 просмотра

2 ответа

489 Репутация автора

enter image description hereI am using cocoapods to integrate Firebase SDK into my swift project . The problem that I face is based on the content of my pod file .

when I install a pod file with the following content

# Uncomment this line to define a global platform for your project
 platform :ios, "9.0"

target "myProject" do
pod 'Firebase'
pod 'Firebase/Database'
pod 'Firebase/Auth'
pod 'Firebase/Core'

end

target "myProjectTests" do
pod 'Firebase'
pod 'Firebase/Database'
pod 'Firebase/Auth'
pod 'Firebase/Core'
end

target "myProjectUITests" do
pod 'Firebase'
pod 'Firebase/Database'
pod 'Firebase/Auth'
pod 'Firebase/Core'
end

I can not import Firebase (no such module as Firebase ) but i am able to import firebaseAuth and ... .

The second case is when I use the following pod file : # Uncomment this line to define a global platform for your project platform :ios, "9.0"

target "myProject" do
use_frameworks!
pod 'Firebase'
pod 'Firebase/Database'
pod 'Firebase/Auth'
pod 'Firebase/Core'

end

target "myProjectTests" do
use_frameworks!    
pod 'Firebase'
pod 'Firebase/Database'
pod 'Firebase/Auth'
pod 'Firebase/Core'
end

target "myProjectUITests" do
use_frameworks!
pod 'Firebase'
pod 'Firebase/Database'
pod 'Firebase/Auth'
pod 'Firebase/Core'
end

and I get this error right a way in the terminal :

     #  from /Users/veronica/Desktop/myProject/Podfile:5
     #  -------------------------------------------
     #  target "myProject" do
     >  use_frameworks!
     #  pod 'Firebase'
     #  -------------------------------------------

by the way I've gone through similar questions to mine and found some answers like :

platform :ios, "9.0"
use_frameworks!

target 'MyProject' do
 pod 'Firebase'
end

but I still get an error just like my own second version Any help is strongly appreciated :)

enter image description here

Автор: Danial Kosarifa Источник Размещён: 18.07.2016 03:40

Ответы (2)


0 плюса

303 Репутация автора

target 'myProject' do
platform :ios, "9.0"

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

end
Автор: andrewcar Размещён: 18.07.2016 03:49

1 плюс

48 Репутация автора

In my podfile I had

pod 'Firebase/Core'
pod 'Firebase/Admob'

I used to be able to access the Firebase libraries simply with just

import Firebase

For some reason it stopped working when I was messing around with my podfile and it would say No such module 'Firebase'. However it would work if I imported individual libraries

import GoogleMobileAds
import FirebaseAnalytics

That was fine but I prefer to have it back the way it was before, and simpler with only one import. I tried a few things and eventually these steps worked

  1. Clean project (not sure if this was necessary)
  2. Remove all Firebase dependencies from the podfile
  3. run pod install
  4. Add Firebase back into the podfile
  5. run pod install again

Then it worked! Hope this helps someone.

Автор: TL77 Размещён: 10.08.2018 12:42
Вопросы из категории :
32x32