我正努力追随苹果Start Developing iOS Apps (Swift) tutorial强的脚步,几乎完成了它.由于我使用的是Xcode 8(我认为它使用的是Swift 3而不是Swift 2),所以我不得不修改本教程的几个部分.但是,我遇到了以下编译器错误,我不知道为什么:
Argument labels (forRow:, inSection) do not match any available overloads
在以下功能中:
@IBAction func unwindToMealList(sender: UIStoryboardSegue) {
if let sourceViewController = sender.sourceViewController as? MealViewController, meal = sourceViewController.meal {
// Add a new meal
let newIndexPath = NSIndexPath(forRow: meals.count, inSection: 0)
meals.append(meal)
tableView.insertRows(at: newIndexPath, with: .bottom)
}
}
我猜NSIndexPath有一个不同的初始化器,它在Swift 3中有所改变,但我找不到它.我做错什么了吗?
谢谢