'WKInterfaceController' 没有可见的@interface 声明了选择器 'initWithContext:'

No visible @interface for 'WKInterfaceController' declares the selector 'initWithContext:'

从上一个 Xcode beta 开始,我的所有项目和所有示例代码都出现了错误,Apple 示例代码如 Lister 应用程序也出现了错误!

No visible @interface for 'WKInterfaceController' declares the selector 'initWithContext:'

问题出在哪里? 谢谢

只需确保您的超级 class 具有具有相同方法签名的方法声明。希望这有帮助.. :)

如果您查看 WKInterfaceController document,您看不到任何名为 initWithContext 的方法。苹果说;

The WKInterfaceController method initWithContext: has been deprecated. Please use awakeWithContext: instead. The designated initializer for WKInterfaceController is now init.

你应该使用:

self = [super init];

不是:

self = [super initWithContext:context];

在 Apple 的文档中,这在 beta 版之间发生了变化:

The WKInterfaceController method initWithContext: has been deprecated. Please use awakeWithContext: instead. The designated initializer for WKInterfaceController is now init.

参见:https://developer.apple.com/library/prerelease/ios/releasenotes/General/RN-iOSSDK-8.2/index.html

而不是

self = [super initWithContext:context];

使用

self = [super init];