My code give me an infinite loop he never go in if or else, I'm pretty sure that because firebase get only asynchronous function.
I want to check if "random_hexa" exist, and get new random until I get a value who don't exist on my database
while (bool_check_while_exist == false)
{
ref.child("Salons").child(random_hexa).observeSingleEventOfType(.Value, withBlock: { (snapshot) in
if (snapshot.exists())
{
random_hexa = self.randomAlphaNumericString(5)
}
else
{
bool_check_while_exist = true
}
})
Aucun commentaire:
Enregistrer un commentaire