This is how I currently populate my table view in WatchKit:
- (void)awakeWithContext:(id)context {
[super awakeWithContext:context];
// Configure interface objects here.
menuItems = [[NSMutableArray alloc] initWithObjects:@"Pizza", @"Chicken", @"Bread", nil];
for (NSString *item in menuItems)
{
MenuRowController *menuRow = [myTableView rowControllerAtIndex:[menuItems indexOfObject:item]];
[menuRow.menuItemLabel setText:item];
}
}
I get the following error:
Extension[980:19597] Error - attempt to ask for row 0. Valid range is 0..0
Printing description of item:
Pizza
2015-07-05 01:58:07.284 ScanBarWatch WatchKit Extension[980:19597] Error - attempt to ask for row 1. Valid range is 0..0
2015-07-05 01:58:14.780 ScanBarWatch WatchKit Extension[980:19597] Error - attempt to ask for row 2. Valid range is 0..0
I tried looking up this error online for a couple of hours but to no avail. No one seems to have a solution.
Try to set the number of rows of the table:
[self.tableView setNumberOfRows:[menuItems count] withRowType:@"MenuRowController"];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With