Ragazzetto
Ragazzetto

Reputation: 642

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

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

Upvotes: 3

Views: 3199

Answers (3)

Dave Wood
Dave Wood

Reputation: 13313

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

Upvotes: 3

John Pollard
John Pollard

Reputation: 3899

Instead of

self = [super initWithContext:context];

use

self = [super init];

Upvotes: 5

Rashad
Rashad

Reputation: 11197

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];

Upvotes: 2

Related Questions