我一直收到这个错误: Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<FoodTracker.MealViewController 0x7faa9ed189d0> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key cancel.'
我正在尝试完成Apple开发人员指南以开始使用iOS应用程序.我的代码和故事板看起来与他们在示例文件中的完全一样.我希望新鲜的眼睛能够看到我不是的东西?
import UIKit
import os.log
class MealViewController: UIViewController, UITextFieldDelegate, UIImagePickerControllerDelegate, UINavigationControllerDelegate {
//MARK: Properties
@IBOutlet weak var nameTextField: UITextField!
@IBOutlet weak var photoImageView: UIImageView!
@IBOutlet weak var ratingControl: RatingControl!
@IBOutlet weak var saveButton: UIBarButtonItem!
/*
This value is either passed by 'MealTableViewController' in
'prepare(for:sender) or constructed as part of adding a new meal.
*/
var meal: Meal? …Run Code Online (Sandbox Code Playgroud)