2014-10-30 75 views
4

我已经尝试编译迅速压倒一切的方法

Overriding method with selector 'initWithStyle:reuseIdentifier:' has incompatibe type '(UITableViewCellStyle, String) -> SweetTableViewCell' 

而且这里的时候,最近一直在学习迅速,在从以前的测试版本我得到这个错误打开一个项目的代码给错误的行

override init(style: UITableViewCellStyle, reuseIdentifier: String) { 
    super.init(style: style, reuseIdentifier: reuseIdentifier) 
    // Initialization code 
} 

回答

3

这是因为在UITableViewCellinit方法已经改变了一点点:

init(style: UITableViewCellStyle, reuseIdentifier: String?) 
                 ^

reuseIdentifier现在是一个可选的字符串。

1

Apple在新的XCode版本中使许多参数和方法值可选。在你的情况下,第二个参数 - reuseIdentifier - 应该是String?而不是String