[英]Cant override controllerDidChangeContent in NSFetchedResultsControllerDelegate
Greetings citizens of Stack, When trying to override "controllerDidChangeContent" I get "Method does not override any method from its superclass". 问候Stack的公民,当尝试覆盖“ controllerDidChangeContent”时,我得到“方法不覆盖其超类中的任何方法”。 The stub is produced by the autocompletion handler and it seems to match the requirements of Apple Documentation .
存根由自动补全处理程序产生,似乎符合Apple Documentation的要求。 Code follows:
代码如下:
import UIKit
import CoreData
class ViewController: UITableViewController, NSFetchedResultsControllerDelegate{
var frc: NSFetchedResultsController<People>?
override func viewDidLoad() {
super.viewDidLoad()
let appdelegate = UIApplication.shared.delegate as! AppDelegate
let context = appdelegate.persistentContainer.viewContext
let request: NSFetchRequest<People> = People.fetchRequest()
request.sortDescriptors = [NSSortDescriptor(key: "id", ascending: true )]
frc = NSFetchedResultsController(fetchRequest: request,
managedObjectContext: context,
sectionNameKeyPath: nil,
cacheName: nil)
}
override func controllerDidChangeContent(_ controller: NSFetchedResultsController<NSFetchRequestResult>) {
print(controller.description)
}
}
The error is produced by the override code. 该错误是由替代代码产生的。 I put the print() in there as filler.
我将print()放在那里作为填充物。 THX
谢谢
Remove override
. 删除
override
。
You are implementing the protocol, not overriding. 您正在实现协议,而不是覆盖。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.