Firebase无法获取当前的UserID

时间:2018-01-06 06:12:00

标签: ios swift firebase

当我从firebase检索数据时,我根据他们的uid检索我想要检索的每个用户的第一个数据

if Auth.auth().currentUser != nil{

        let queryRef = Database.database().reference().child("Details")

//here, its getting the u id

        let userID : String = (Auth.auth().currentUser?.uid)!
        print("Current user ID is" + userID)
        self.databaseHandler = self.readData.child("Details").observe(.value, with: { (snapshot) in
            self.postData = ((snapshot.value) as? [String : AnyObject]!)!

            //print data to see if you require
            //print it to generate loop for required things
            print(self.postData)

0 个答案:

没有答案