iOS Swift - Firebase query never gets called

℡╲_俬逩灬. 提交于 2021-01-28 18:39:30

问题


I just want to make a query and search if an email exists, but my query never gets called. This is my code:

func emailAvailable(email: String, completion: (result: String)-> Void){
    let ref = self.dbRef.child("usuarios")
ref.queryOrderedByChild("emailUsuario").queryEqualToValue(email).observeSingleEventOfType(.Value, withBlock: { snapshot in
        //NEVER ENTER HERE

        if snapshot.exists(){
            completion(result: "N")
        }else{
            completion(result: "Y")
        }
    })
}

For test I only have this in my realtime Database:

usuarios{
 daniel{
  emailUsuario: "daniel@test.com"
 },
 omar{
  emailUsuario: "omar@test.com"
 }
}

This problem wasn't happening before I upgrade to the new Firebase. I even test with no data at all, and the snapshot was Nil.

I have configured Firebase in AppDelegate like the documentation and the values in my GoogleService-Info.plist is ok. Thanks in advance for your help

来源:https://stackoverflow.com/questions/37958065/ios-swift-firebase-query-never-gets-called

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!