这段代码:
类接口(interface) Controller :WKInterfaceController {
@IBOutlet weak var petTable: WKInterfaceTable!
var petnames = ["Luna", "dylan", "Mery", "Mady", "Paul Newman", "heidi"]
override init(context: AnyObject?) {
// Initialize variables here.
super.init(context: context)
返回两个错误: “Initializer does not override a designated initializer from its superclass”行覆盖
在 super.init 行中“必须调用父类(super class)‘WKInterfaceController’的指定初始化器”
错误出现在 Xcode 6.2 beta 2(今天发布)
在之前版本的Xcode中没有错误显示
最佳答案
替换
override init(context: AnyObject?) {
// Initialize variables here.
super.init(context: context)
// Configure interface objects here.
NSLog("%@ init", self)
}
与
override func awakeWithContext(context: AnyObject?) {
super.awakeWithContext(context)
// Configure interface objects here.
NSLog("%@ awakeWithContext", self)
}
清理你的项目,然后构建并运行
关于Xcode 6.2 beta 2 WKInterfaceController watchkit 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27411410/