我一直在这里关注苹果教程并遇到错误:
2016-01-12 09:34:32.909 FoodTracker[1812:124509] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'unable to dequeue a cell with identifier MealTableViewCell - must register a nib or a class for the identifier or connect a prototype cell in a storyboard'
Run Code Online (Sandbox Code Playgroud)
程序运行时出现错误,并且AppDelegate.swift的类行上出现红色突出显示的行
正如我通过断点发现的那样,这些是我认为导致错误的代码行:
override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cellIdentifier = "MealTableViewCell"
let cell = tableView.dequeueReusableCellWithIdentifier(cellIdentifier, forIndexPath: indexPath) as! MealTableViewCell
// Configure the cell...
let meal = meals[indexPath.row]
cell.nameLabel.text = meal.name
cell.photoImageView.image = meal.photo …
Run Code Online (Sandbox Code Playgroud)