我不确定如何在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)
}
答案 0 :(得分:0)
init?(_:)
函数中没有任何内容可能会失败并迫使您返回nil
。只需删除init签名的尾随问号。
override init(fileURL url: NSURL) {
super.init(fileURL: url)
let center = NSNotificationCenter.defaultCenter()
center.addObserver(self, selector: "thingsDidChange:", name: WhatsitDidChangeNotification, object: nil)
}