检索firebase中childByAutoID存储的数据

时间:2016-08-18 15:20:43

标签: swift firebase firebase-realtime-database

在firebase中,我试图通过使用childByAutoID()来检索存储在firebase实时数据库中的数据,以便为数据提供唯一标识符,但问题是我不完全确定如何实现这一点?

func retData(){
    rootRef.child("users").child(userID).ChildByAutoID().observeEventType(.Value){
        (snap: FIRDataSnapshot) in

    self.simpleLabel.text = snap.value?.description

    }   
 }

Json数据结构

-userID
   -childByAutoID
      -player1
         -email 

1 个答案:

答案 0 :(得分:1)

如果您的JSON结构是: -

Tools -> Internet Options > Advanced > Security Section > 
Uncheck Check for publicher's certificate revocation 
AND 
Uncheck Check for server certificate revocation

使用: -

-users
  -childByAutoID
    -playerID
      -email