我正在尝试从firebase设置节点加载一些设置数据.其他函数中其他节点的相同代码可以正常工作,但这个代码不明确.为什么?
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. }解决方法 改变这个:
ref.child("Settings").child("service_types").observe(.value) { (snapshot) in}
对此:
ref.child("Settings").child("service_types").observe(.value,with: { snapshot in})
另见firebase documentation section Listen for value events
总结以上是内存溢出为你收集整理的swift – 使用observe firebase DB的模糊不清全部内容,希望文章能够帮你解决swift – 使用observe firebase DB的模糊不清所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)