3

From the last Xcode beta i've got an error in all my project and in all my sample code , also as in Apple Sample code like Lister app !

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

enter image description here

Where is the problem ? Thanks

4

3 回答 3

5

Instead of

self = [super initWithContext:context];

use

self = [super init];
于 2015-01-07T21:06:00.740 回答
3

From Apple's Docs, this was changed between beta's:

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

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

于 2015-01-06T22:26:29.540 回答
2

Just make sure your super class has that method declaration with same method signature. Hope this helps.. :)

If you look at WKInterfaceController document you can't see any method named initWithContext. Apple said;

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

You should use :

self = [super init];

Not:

self = [super initWithContext:context];
于 2015-01-06T10:02:08.450 回答