我想用iOS模擬器在Swift中運行一個簡單的Table View應用程序。 但是一旦模擬器啓動,應用程序就會崩潰。Swift程序在Xcode上崩潰
這裏是我的代碼
import UIKit
class ViewController: UIViewController, UITableViewDataSource,UITableViewDelegate {
var restaurantNames = ["Cafe Deaden", "Home 1", "Teakha", "cafe Loisal","petite Oyster","For Kee Restaurant","pos Atelier","Bourke Street Bakery", "Haigh's Chocolate"]
func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
// Return the number of rows in the section.
return restaurantNames.count
}
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) ->
UITableViewCell {
let cellIdentifier = "Cell"
let cell = tableView.dequeueReusableCellWithIdentifier(cellIdentifier, forIndexPath:
indexPath) as UITableViewCell
// Configure the cell...
cell.textLabel!.text = restaurantNames[indexPath.row]
return cell
}
}
它說線程1斷點1.5 VAR restaurantNames。 我不知道從哪裏開始排除故障。任何幫助將是巨大的
感謝和歡呼聲
一些蘋果文檔如果添加** *完全錯誤消息,它幫助。接下來:關於使用Xcode調試器的readdup,您對Xcode和調試器瞭解得越多,開發代碼就越容易。 – zaph