Mehrdeutige Verwendung von observ firebase DB
Ich kann wirklich nicht verstehen, was falsch ist?
Ich versuche, einige Einstellungsdaten von firebase zu ladenSettings
Knoten. Der gleiche Code für andere Knoten in anderen Funktionen funktioniert, aber dieser ist mehrdeutig. Warum
var ref:FIRDatabaseReference! //Global variable
override func viewDidLoad() {
super.viewDidLoad()
self.mapView.delegate = self
if CLLocationManager.locationServicesEnabled() {
locationManager.delegate = self
locationManager.desiredAccuracy = kCLLocationAccuracyBest
locationManager.requestWhenInUseAuthorization()
locationManager.startUpdatingLocation()
// monitorRegion()
} else {
// Alert to enable location services on iphone first
}
ref = FIRDatabase.database().reference(fromURL: "https://*******.firebaseio.com/")
//The error is here
ref.child("Settings").child("service_types").observe(.value) { (snapshot) in
}
// Do any additional setup after loading the view.
}