iossemanticswatchkitwkinterfacegroup

No visible @interface for 'WKinterfaceGroup' declares the selector: has something changed in iOS 8.3?


I am using iOS SDK 8.3 and trying to follow this tutorial to create a table in a watch kit app.

I added an Table on interface controller of the iWatch app and then linked it to my InterfaceController. The I created a custom row class and linked the row to the row controller class. I then added a couple of items in the row and linked these to outlets in the row controller class. However I get some errors:

enter image description here

This is my interface controller class:

#import <WatchKit/WatchKit.h>
#import <Foundation/Foundation.h>

@interface InterfaceController : WKInterfaceController

@property (strong, nonatomic) NSArray *devicesArray;

@property (weak, nonatomic) IBOutlet WKInterfaceGroup *devicesTable;

@end

And this is the code that triggers the errors:

- (void)awakeWithContext:(id)context {
    [super awakeWithContext:context];
    NSLog(@"%@ initWithContext", self);
    self.devicesArray = @[@"type A", @"type B"];
    [self.devicesTable setNumberOfRows:self.devicesArray.count withRowType:@"MyTableRowController"];

    [self.devicesTable enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {

        MyTableRowController* row = [self.devicesTable rowControllerAtIndex:idx];

        [row.deviceType setText: (NSString*)obj];
        [row.logo setImage:[UIImage imageNamed:(NSString *)obj]];

    }];

enter image description here


Solution

  • Looking at the tutorial, it seems to have got a bit confused.

    The WKInterfaceGroup that is used is for the "MyTableRowController" Subclass you have created.

    The main "InterfaceController" should have devicesTable as a WKInterfaceTable

    Apple Doc's on WKInterfaceTable

    Apple Doc's on WKInterfaceGroup