我發現這個錯誤,沒有任何指示,當顯示我的tableView時出現錯誤。EXC_BREAKPOINT(code = EXC_i386_BPT,subcode = 0x0)(lldb)
這裏的tableViewCell的一部分,這可能是問題的根源:
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
// Dequeue cell
let cell: UITableViewCell! = self.clientTable.dequeueReusableCellWithIdentifier("ClientCell", forIndexPath: indexPath)
// Unpack message from Firebase DataSnapshot
let messageSnapshot: FIRDataSnapshot! = self.messages[indexPath.row]
let message = messageSnapshot.value as! Dictionary<String, String>
let date = message[Constants.MessageFields.date] as String!
if let imageUrl = message[Constants.MessageFields.imageUrl] {
if imageUrl.hasPrefix("gs://") {
FIRStorage.storage().referenceForURL(imageUrl).dataWithMaxSize(INT64_MAX){ (data, error) in
if let error = error {
print("Error downloading: \(error)")
return
}
cell.imageView?.image = UIImage.init(data: data!)
}
} else if let url = NSURL(string:imageUrl), data = NSData(contentsOfURL: url) {
cell.imageView?.image = UIImage.init(data: data)
}
cell!.textLabel?.text = "sent by: \(date)"
} else {
let text = message[Constants.MessageFields.weight] as String!
cell!.textLabel?.text = date + ": " + text
cell!.imageView?.image = UIImage(named: "ic_account_circle")
if let photoUrl = message[Constants.MessageFields.photoUrl], url = NSURL(string:photoUrl), data = NSData(contentsOfURL: url) {
cell!.imageView?.image = UIImage(data: data)
}
}
return cell!
}
整個項目是基於火力地堡的教程,我只是做一個測試的變化很少。
下面是該項目: Github Link
在此先感謝。
啊,它工作!謝謝 !!我對Firebase相關功能非常陌生,所以不知道如何處理它們。我一定會在你的代碼上研究更多的基礎。再次感謝! – Kei