Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
333 views
in Technique[技术] by (71.8m points)

swift - getting expected ')' '}' in expression list. how do i solve this

i keep getting an "expected expression" and expected ')' '}' in expression list how do i solve this.i have tried to solve it by removing the brackets but it still wont work. import UIKit import Firebase import FirebaseDatabase

  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.
}
*/

    )}

}

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Your brackets enclosures are off. Make sure you are properly closing all brackets.

    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"


        }}

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...