【发布时间】:2018-03-22 14:27:46
【问题描述】:
我遇到了一个问题,当我试图重写一个函数时,它告诉我超类中没有方法。子类在 XCTest 中。当我在常规项目中进行子类化时,它可以正常工作,但 XCTest 由于某种原因无法正常工作下面是代码
超类
class BackupServerCell: UITableViewCell {
@IBOutlet var serverNameLabel: UILabel!
@IBOutlet var serverDescriptionLabel: UILabel!
func configCell(with server: VeeamBackupServer) {
}
}
子类 - 位于 XCTest 文件中
class MockBackupServerCell : BackupServerCell {
var configCellGotCalled = false
override func configCell(with server: VeeamBackupServer) {
configCellGotCalled = true
}
}
【问题讨论】:
-
尝试清理项目,然后构建并运行,然后再次运行测试
标签: swift overriding subclass xctest