swift – 使用observe firebase DB的模糊不清

swift – 使用observe firebase DB的模糊不清,第1张

概述我真的不能得到什么问题? 我正在尝试从firebase设置节点加载一些设置数据.其他函数中其他节点的相同代码可以正常工作,但这个代码不明确.为什么? var ref:FIRDatabaseReference! //Global variable override func viewDidLoad() { super.viewDidLoad() se 我真的不能得到什么问题?
我正在尝试从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的模糊不清所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/web/1012901.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-22
下一篇 2022-05-22

发表评论

登录后才能评论

评论列表(0条)

保存