[英]Failable Initializer 'init(fileURL:) cannot override a non-failable initializer
I am not sure how to fix this error in Xcode 6.4 我不确定如何在Xcode 6.4中修复此错误
override init?(fileURL url: NSURL) {
super.init(fileURL: url)
let center = NSNotificationCenter.defaultCenter()
center.addObserver(self, selector: "thingsDidChange:", name: WhatsitDidChangeNotification, object: nil)
}
deinit {
let center = NSNotificationCenter.defaultCenter()
center.removeObserver(self)
}
There is nothing in your init?(_:)
function that can fail and force you to return nil
. 您的
init?(_:)
函数中没有什么会失败并迫使您返回nil
。 Simply remove the trailing question mark of the init signature. 只需删除init签名的结尾问号。
override init(fileURL url: NSURL) {
super.init(fileURL: url)
let center = NSNotificationCenter.defaultCenter()
center.addObserver(self, selector: "thingsDidChange:", name: WhatsitDidChangeNotification, object: nil)
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.