【发布时间】:2019-11-26 21:32:47
【问题描述】:
我在表达式列表中不断得到一个“预期的表达式”和预期的 ')' '}' 我该如何解决这个问题。我试图通过删除括号来解决它,但它仍然不起作用。 导入 UIKit 导入 Firebase 导入 Firebase 数据库
class SearchViewController: UIViewController {
@IBOutlet weak var tableView: UITableView!
var postData = [String]()
var ref: DatabaseReference!
var databaseHandle: DatabaseHandle?
override func viewDidLoad() {
super.viewDidLoad()
//let db = Firestore.firestore()
// Do any additional setup after loading the view.
ref = Database.database().reference()
databaseHandle = ref?.child("users").observe(DataEventType .childAdded, with: {
(snapshot) in
// code to execute when child added under users
let post = snapshot.value as? String
if let actualPost = post {
self.postData.append(actualPost)
self.tableView.reloadData()
) "expected expression"
}
/*
// MARK: - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
// Get the new view controller using segue.destination.
// Pass the selected object to the new view controller.
}
*/
)}
}
【问题讨论】:
-
平衡 ".. post {" with "}",而不是 ")"..
-
看起来你只需要一个 } 而不是 )