现在,用户可以注册用户名和密码,并正确注册我的firebase。点击登录没有任何输入允许匿名用户。然而,在登录后,它会带您进行群聊,每个人都在键入一个大型聊天室。在那里不止10个人,至少可以说是混乱的。
我认为问题出在这里?
private func observeMessages() {
let messagesQuery = messageRef.queryLimitedToLast(25)
messagesQuery.observeEventType(.ChildAdded) { (snapshot: FDataSnapshot!) in
let id = snapshot.value["senderId"] as! String
let text = snapshot.value["text"] as! String
self.addMessage(id, text: text)
self.finishReceivingMessage()
}
这是我第一次使用FireBase等后端的真实体验。那不然只允许你和另一个人交谈吗?
或者我是否必须添加另一个带有单元格视图的Controller来显示不同的聊天会话(如本机iOS Messenger)
这是你想要的吗?
{
"messages" : {
"-KHQAJGo3m78smQV-7p8" : {
"senderId" : "7bdc0969-b2ad-4273-a1da-0b3fc4833c10",
"text" : "Test"
},
"-KHQAPMujDpUOrfcghS9" : {
"senderId" : "7bdc0969-b2ad-4273-a1da-0b3fc4833c10",
"text" : "What\nIs \nGoing on"
},
"-KHQAu88NghIScIw3OPL" : {
"senderId" : "fcc1c883-09c5-4c72-9e4e-3a9a745909a6",
"text" : "The gab shook"
},
"-KHQAv8G1OH6nN2m1LvW" : {
"senderId" : "fcc1c883-09c5-4c72-9e4e-3a9a745909a6",
"text" : "Haha"
},
"-KHQAwK9i4gIp6PkPIZl" : {
"senderId" : "fcc1c883-09c5-4c72-9e4e-3a9a745909a6",
"text" : "What!"
},
"-KHQBx6o-jMn_8mxRCuu" : {
"senderId" : "14ef0bf5-15c2-4f20-baf1-b2a58518932f",
"text" : "Hhhhh"
},
"-KHQDOiNU2LAqSecFKf2" : {
"senderId" : "549572b6-24ec-4de6-806f-db6e350c24fe",
"text" : "Ggg"
},
"-KHQEcT9LyQl0VrO-kzY" : {
"senderId" : "810fda99-8214-44d8-9192-69208a8404a3",
"text" : "Why is there no indicator"
},
"-KHQEdr_3ei9D_Ang6yY" : {
"senderId" : "810fda99-8214-44d8-9192-69208a8404a3",
"text" : "Oh there it is"
},
"-KHQEigc7AA0lrd-6gvn" : {
"senderId" : "810fda99-8214-44d8-9192-69208a8404a3",
"text" : "Omg"
},
"-KHQEk88QFGWTyhBHlJc" : {
"senderId" : "549572b6-24ec-4de6-806f-db6e350c24fe",
"text" : "Sweet"
},
"-KHQEtuMw7C7ZIRfqtvV" : {
"senderId" : "549572b6-24ec-4de6-806f-db6e350c24fe",
"text" : "Now we can text each other"
},
"-KHQEwJlF-ejfH3QntLx" : {
"senderId" : "549572b6-24ec-4de6-806f-db6e350c24fe",
"text" : "So COOL! =)"
},
"-KHQExUTfOl1S1uNXhr0" : {
"senderId" : "810fda99-8214-44d8-9192-69208a8404a3",
"text" : "That's awesome!"
},
"-KHQF-3WUjiWd7PlW9lW" : {
"senderId" : "549572b6-24ec-4de6-806f-db6e350c24fe",
"text" : "Uh oh"
},
"-KHQF57qctPHTRsFIWz4" : {
"senderId" : "810fda99-8214-44d8-9192-69208a8404a3",
"text" : "Your actually texting me, holy shit"
},
"-KHQF7DcRRB8JyJwQFH5" : {
"senderId" : "549572b6-24ec-4de6-806f-db6e350c24fe",
"text" : "Stupid\n\nImagine if 100000 people were in here...would be chaos"
},
"-KHQF9vXLZNeKOvX8T0I" : {
"senderId" : "549572b6-24ec-4de6-806f-db6e350c24fe",
"text" : "Don't get excited exiting simulator now"
},
"-KHQFBU1THZe1x1wUeEx" : {
"senderId" : "549572b6-24ec-4de6-806f-db6e350c24fe",
"text" : "Good Bye"
},
"-KHQFBj5EpvrnDd4PCJb" : {
"senderId" : "810fda99-8214-44d8-9192-69208a8404a3",
"text" : "Figures"
},
"-KHQXXd0YWvKgD9iN9-u" : {
"senderId" : "30f0983b-4dc8-4cc7-92ff-e9585f2ffe86",
"text" : "Hmm"
},
"-KHQXaiuIg0eLb0d5f3Y" : {
"senderId" : "30f0983b-4dc8-4cc7-92ff-e9585f2ffe86",
"text" : "Ugh"
},
"-KHQXg-dzVL2vmltAwf2" : {
"senderId" : "30f0983b-4dc8-4cc7-92ff-e9585f2ffe86",
"text" : "Just"
},
"-KHQXo3MTZmlGTzUYitR" : {
"senderId" : "73383e6c-3123-437c-b11e-51f0b35444a8",
"text" : "What"
}
},
"typingIndicator" : {
"30f0983b-4dc8-4cc7-92ff-e9585f2ffe86" : false,
"73383e6c-3123-437c-b11e-51f0b35444a8" : false
}
}