iosobjective-cwatchkitwkinterfacetable

Why does method rowControllerAtIndex of WKInterfaceTable return nil?


When I run the code below, the method rowControllerAtIndex of WKInterfaceTable returns nil.

[self.outletTable setNumberOfRows:numberOfCategoriesToShow withRowType:@"rowTypeLabel"];
RowControllerTypeLabel *theRow = [self.outletTable rowControllerAtIndex:rowInTable];

What I've checked:

  1. I have made the connection between the row in the storyboard and the corresponding property in the interface of RowControllerTypeLabel.
  2. I have set the field Custom Class of my label to my custom class RowControllerTypeLabel.
  3. I have also made the connection between the table in the storyboard and the corresponding property in the interface of my interface controller.

What am I missing?


Solution

  • I forgot to set the row controller's identifier rowTypeLabel in the Attributes inspector.

    I hope that this post will help others to find the problem in a shorter time than I needed.