我正在使用 swift 工作,但不断收到错误"连续语句必须用两个"uid"之间的';'分隔">
let uid = Auth.auth().currentUser?.uid
let title = postTextField.text
let content = contentTextField.text
let postObject = {
"uid": uid,
"title": title,
"content": content
}
Database.database().reference().child("posts").childByAutoId().setValue(postObject)
print("Posted to Firebase")
声明和初始化字典时不要使用大括号。 使用方括号。
let postObject = [
"uid": uid,
"title": title,
"content": content
]