Cannot Import Firebase Into Swift Class

后端 未结 11 1882
[愿得一人]
[愿得一人] 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: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
    

提交回复
热议问题