Yic*_*man 2 ios swift watchkit
我刚刚更新了Xcode的新测试版,继续使用我的WatchKit应用程序
更新了所有WatchKit扩展文件后,我立即收到错误消息
"初始化程序不会覆盖其超类中指定的初始值设定项"
我在更新之前没有收到此错误,不知道如何修复它.
任何见解?
这是我的代码
class InterfaceController: WKInterfaceController {
override init(context: AnyObject?) {
// Initialize variables here.
super.init(context: context)
// Configure interface objects here.
NSLog("%@ init", self)
}
override func willActivate() {
// This method is called when watch view controller is about to be visible to user
super.willActivate()
NSLog("%@ will activate", self)
}
override func didDeactivate() {
// This method is called when watch view controller is no longer visible
NSLog("%@ did deactivate", self)
super.didDeactivate()
}
}
Run Code Online (Sandbox Code Playgroud)
在Beta 3版本中,initWithContext现已被弃用.你应该用awakeWithContext.initWKInterfaceController类的方法现在被指定为初始化器.
参考:https: //developer.apple.com/library/prerelease/ios/releasenotes/General/RN-iOSSDK-8.2/index.html,注释部分.