I am trying to use the Firebase database. I was watching a tutorial on how to use Firebase and wrote this line of code, FIRDatabase.database().reference()
. Then I got an error saying, Use of unresolved identifier FIRDatabase. I don't know what is wrong I imported Firebase and FirebaseDatabase.
My Podfile
# Uncomment the next line to define a global platform for your project
platform :ios, '10.2'
target 'FirebaseDatabase' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
# Pods for FirebaseDatabase
pod 'Firebase'
pod 'Firebase/Core'
pod 'Firebase/Database'
end
In Swift 4,
Write this command in your pod file.
pod 'Firebase/Database'
Then import in your ViewController like this
import FirebaseDatabase
Full structure of ViewController code like this
import UIKit
import FirebaseDatabase
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
}
}
for me Xcode 8.3, Swift 3, this works:
import FirebaseDatabase
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With