Error retrieving data from firebase with xcode

0

I'm having trouble retrieving information from firebase, see the codes: From what I understand in the errors I'm doing something wrong to recover the data, it must be something with the data dictionary ...

I'm adding without error:

To add

@IBAction func RegistrarReparoBuraco(_ sender: UIButton) {
        ref = FIRDatabase.database().reference()
        //ref?.child("Reparos").childByAutoId().setValue(Coordenadas)

        ref?.child("Reparos").child((FIRAuth.auth()?.currentUser?.uid)!).childByAutoId().setValue(
            [
                "DIA_SOLICITACAO" : dataSolicitacao.text!,
                "OBSERVACOES" : observacoes.text ?? "",
                "COORDENADAS" : Coordenadas,
                "CELULAR": celular.text ?? "",
                "SITUACAO": "Aguardando",
            ]
        )

        Cleaner()
    }

Can anyone help? I do not have much experience ...

class model

import UIKit

class RegistroModel: NSObject{

    var diaSolicitacao: String?
    var situacao: String?
    var coordenadas: String?


}

class that retrieves firebase information

import UIKit
import Firebase
import FirebaseDatabase

class ViewControllerRegistros: UITableViewController{


    @IBOutlet var tblRegistros: UITableView!


    var ref: FIRDatabaseReference!
    var refHandle: UInt!
    //let cellId = "cellId"
    var RegistroList = [RegistroModel]()

    override func viewDidLoad() {
        super.viewDidLoad()
        //FIRDatabase.database().persistenceEnabled = true
        ref = FIRDatabase.database().reference()
        fetchRegistros()

           }


    override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        return RegistroList.count
    }

    override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
        let cell = UITableViewCell(style: .subtitle, reuseIdentifier: "cellId")

        //set cell contents
        cell.textLabel?.text = RegistroList[indexPath.row].situacao


        return cell

    }

    func fetchRegistros(){

        refHandle = ref.child("Reparos").observe(.childAdded, with: {(snapshot) in

            if let dictionary = snapshot.value as? [String: AnyObject]{

                let registro = RegistroModel()

                registro.setValuesForKeys(dictionary)
                self.RegistroList.append(registro)

                DispatchQueue.main.async{
                    self.tableView.reloadData()


                }
            }
        })

    }

Firebase data structure

Reparos
 a6GeSfL1gMfeCccjEGSJxEflxPZ2
 -KjNXMOtwVXlRtkga4As
 CELULAR: "041 96972354"
 COORDENADAS: "Optional(\"(37.785716629014757, -122.40611205304..."
 DIA_SOLICITACAO:"May 5, 2017 at 9:14 AM"
 OBSERVACOES:"Aaafdsfsdfsdfsdfsfsfsdfsdfsd"
 SITUACAO: "Aguardando:


}
    
asked by anonymous 05.05.2017 / 21:06

0 answers