Hello,
Thanks to accepting me in your Forums.
I have a problem to read data in my FireDataBase.
My listing …
//
// ViewController.swift
// FirebaseDatabase
//
// Created by Michel on 08/05/2017.
// Copyright © 2017 Michel . All rights reserved.
//
import UIKit
import FirebaseDatabase
import Firebase
var pdej: Int16 = 0
var boiss: Int16 = 0
var bouche: Int16 = 0
var conser: Int16 = 0
var rfrai: Int16 = 0
var patis: Int16 = 0
var fleg: Int16 = 0
var epice: Int16 = 0
var fecul: Int16 = 0
var hyent: Int16 = 0
var sauc: Int16 = 0
class ViewController: UIViewController {
var ref:FIRDatabaseReference!
var refHandle: UInt!
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
ref = FIRDatabase.database().reference()
self.ref.child("pListe").observeSingleEvent(of: .value, with: { (snapshot) in
if let result = snapshot.children.allObjects as? [FIRDataSnapshot] {
for child in result {
//do your logic and validation here
var PDEJ = child.key
print(PDEJ) // print my solution
}
} else {
print("no results")
}
}) { (error) in
print(error.localizedDescription)
}
}
There you can read my FirDatabase :
listecourse-97211
!
!_ pListe : !- boiss : 10
!- bouche : 110
!- conser : 120
!- epice : 133
!- fecul : 145
!- fleg : 154
!- hyent : 161
!- patis : 172
!- pdej : 189
!- rfrai : 111
!- sauc : 151
i want to give the variable A = value ( “pListe”)
variable B = value ( “boiss”)
variable C = value ( “10”)
I do not have the good solution, but I did not understand why… Can someone help me please.
my solution obtain on PDEJ
2017-06-08 19:02:05.400095+0200 GestionCourse[3909:796180] [MC] System group container for systemgroup.com.apple.configurationprofiles path is /private/var/containers/Shared/SystemGroup/systemgroup.com.apple.configurationprofiles
2017-06-08 19:02:05.405939+0200 GestionCourse[3909:796180] [MC] Reading from public effective user settings.
boiss
bouche
conser
epice
fecul
fleg
hyent
patis
pdej
rfrai
sauc
I need yours help for the Variables A, B, C
Thanks for yours helps