からキーを取得します。 「メンバー」/「1」の下は、どのように私は(SWIFT 4/IOSを使用して)firestoreドキュメント例として使用されているデータベースやメッセージアプリを平坦化についての情報があるfirebaseデータベースのfirebaseドキュメントで
https://firebase.google.com/docs/database/web/structure-data
// Conversation members are easily accessible
// and stored by chat conversation ID
"members": {
// we'll talk about indices like this below
"one": {
"ghopper": true,
"alovelace": true,
"eclarke": true
},
"two": { ... },
"three": { ... }
},
各キーは、チャットに参加するメンバーの名前です。 firebaseデータベースには、各キーを取得するgetKeyメソッドがあることは確かです。
私は同様の方法でデータベースをセットアップしましたが(firebaseではなくfirestoreを使用します)、各チャットは一意の識別子で、ドキュメントにはfirebase認証IDなどのチャットメンバーが含まれています。
var docsref: DocumentReference?
docsref = self.defaultStore?.colleection("chats").document(chatID)
docsref?.getDocument { (document, error) in
if let _ = document {
print("document!.data()")
} else {
print("Document does not exist")
}
}
いつI出力:参加チャットメンバーとブールの1のfirebase認証コードです:
print(document!.data())
私は[1 "2mHuccccxxxxxxxxxxk4wkIAt33を"]を得ます。
私はそのキーを取得したいが、方法がわからなかったでしょう。
ありがとうございました。