在我在模拟器中构建应用程序之前,Xcode不会抛出任何错误。一旦模拟器启动,它就会触发SIGABRT错误。这是我的代码:
import UIKit
class ViewController: UIViewController, UITableViewDelegate {
var cellContent = ["example"]
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
}
func numberOfRowsInSection(section: Int) -> Int {
return cellContent.count
}
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell = UITableViewCell(style: UITableViewCellStyle.Default, reuseIdentifier: "Cell")
cell.textLabel?.text = cellContent[indexPath.row]
return cell
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}