Ich bin ein Neuling zu schnellen und Firebase, ich versuche, meine Tabelle mit Firebase Daten zu füllen. Wenn ich das Programm starte, erscheint nichts in der Tabellenansicht. Jede Hilfe würde gerne geschätzt werden. Dies ist, was ich bisher gemacht habe, versuchte, die Dokumente zu lesen, aber es hilft nicht.Swift 2 Firebase TableView
import UIKit
import Firebase
import FirebaseUI
class ChurchTableViewController: UITableViewController {
let firebase = Firebase(url:"https://.....com/")
var items = [NSDictionary]()
override func viewDidLoad() {
super.viewDidLoad()
// Uncomment the following line to preserve selection between presentations
// self.clearsSelectionOnViewWillAppear = false
// Uncomment the following line to display an Edit button in the navigation bar for this view controller.
//self.navigationItem.rightBarButtonItem = self.editButtonItem()
}
override func viewDidAppear(animated: Bool) {
//MARK: Load data from firebsr
firebase.observeEventType(.Value, withBlock: { snapshot in
print(snapshot.value)
}, withCancelBlock: { error in
print(error.description)
})
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
// MARK: - Table view data source
override func numberOfSectionsInTableView(tableView: UITableView) -> Int {
// #warning Incomplete implementation, return the number of sections
return 1
}
override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
// #warning Incomplete implementation, return the number of rows
return items.count
}
override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCellWithIdentifier("Cell", forIndexPath: indexPath)
let dict = items[indexPath.row]
cell.textLabel?.text = dict["ChurchName"] as? String
return cell
}
Nach dem Download Lauf Dieser Befehl tableview.reloaddata() –
Vielleicht ist Ihre URL falsch? –
Es gibt ein exzellentes Tutorial genau dafür, richtig [HIER] (https://www.raywenderlich.com/109706/firebase-tutorial-getting-started) – MikeG