I created a new Xcode project, added the \'Firebase\' pod to my pod file and installed it, and added the Google-services.plist file and the rest according to the Firebase docume
As in swift4 the 'FIRDatabaseReference' has been renamed to 'DatabaseReference'
So, use:
var ref:DatabaseReference!
EDIT: I found the real problem behind. Firebase had update. User need to update the firebase version via cocopod. After update the cocopod, can use everything normally same as firebase Doc.
==========================================
I have the same problem, but cannot fix it by updating the pod-file.
Finally, I find out a solution.
Google teach us to import only
import Firebase
Just add:
import FirebaseDatabase
and everything will become fine
On your Podfile, add additional line of
pod 'Firebase/Database'
Then on your code section
import FirebaseDatabase
And it should work now, with the following code:
var ref: DatabaseReference!
In your Podfile, add pod
pod 'Firebase/Database'
Then import Firebase Database in your ViewController
import FirebaseDatabase
Create a globle var ref
that you can use it anywhere in viewcontroller
var ref: DatabaseReference!
Now, In viewDidLoad
Define the ref
ref = Database.database().reference()
Just had the same problem, but after a while I realized that I was missing an entry in the pod-file, your pod-file should contain:
pod 'Firebase/Database'
Hope it works now :)
Problem solved by removing "FIR"
form the words ("FIRDatabaseReference" and "FIRDatabaseHandle")
Also that import "Firebase" in the viewController