Cannot Import Firebase Into Swift Class

后端 未结 11 1799
[愿得一人]
[愿得一人] 2020-12-03 06:29

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\".

相关标签:
11条回答
  • 2020-12-03 07:09

    If you imported Firebase manually, update Framework Search Paths and Header Search Paths under your target's Build Settings so they include the Firebase frameworks.

    0 讨论(0)
  • 2020-12-03 07:15

    So after spending hours and hours trying to fix this error I did the following and my life went back to normal

    a) Went to my Podfile and changed pod 'Firebase', '~> 4.8' to pod 'Firebase/Core'

    b) Then I went into my AppDdelegate changed from import Firebase to import FirebaseCore

    If you were facing the same problem as me this solution will work for you

    0 讨论(0)
  • 2020-12-03 07:16
    1. open terminal and type cd "drag and drop your project" Enter
    2. type "pod init"
    3. open pod file with xcode
    4. under use_frameworks! type pod 'Firebase' pod 'Firebase/xxx'
    5. back to terminal and type "pod install" 6.open your project folder and run xxx.xcworkspace
    0 讨论(0)
  • 2020-12-03 07:17

    For me, I had to make sure that cocoapods was updated to version 1.0.0.

    Just run sudo gem install cocoapods, then clean project and pod install. Compiler should not complain anymore.

    0 讨论(0)
  • 2020-12-03 07:17

    For me, I found that I wrote the line : (pod 'Firebase') in the wrong line in the pod file. you only need to find the comment : # Pods for projectName and then replace it with pods like: pod 'Firebase' or : pod 'Firebase/Auth'

    0 讨论(0)
  • 2020-12-03 07:19

    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
    
    0 讨论(0)
提交回复
热议问题