这段代码:
类InterfaceController: 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未覆盖来自其超类的指定初始化器”
在super.init行中“必须调用超类‘WKInterfaceController’的指定初始值设定项
该错误存在于Xcode 6.2测试版2中(今天发布)
在上一版本的Xcode中,没有显示错误
发布于 2014-12-11 10:23:17
替换
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)
}清理项目,然后构建并运行
发布于 2014-12-11 06:21:37
init(context: AnyObject?)已不复存在。对于初始化,只需使用init,然后使用awakeWithContext从上下文进行初始化。
https://stackoverflow.com/questions/27411410
复制相似问题