0

When I try to launch my apple watch app with the following code, it crashes after the log prints "produce" (there is nothing after that). When I remove the code, it does not crash. I cannot figure out what could be going wrong.

 NSMutableArray *rowTypesList = himo; //himo is a nsmutablearray that contains info from NSXMLParser
        [_table setRowTypes:rowTypesList];
        for (NSInteger i = 0; i < _table.numberOfRows; i++)
        {
            NSDictionary *itemAtIndex =(NSDictionary *)[himo objectAtIndex:i];
            NSObject *row = [_table rowControllerAtIndex:i];
            Cell *importantRow = (Cell *) row;
            [importantRow.label setText:@"hi"];
        }
NSLog(@"produce");
1
  • 1
    What is the crash log?
    – Fogmeister
    Mar 1, 2015 at 2:56

1 Answer 1

0

It looks like you are mixing your data you want to display in your table with the row controller type. If you just have a single row controller type of Cell which it appears you do by your code you want the following:

[_table setNumberOfRows:[himo count] withRowType:@"theIdentiferYouGaveTheRowControllerInTheStoryboard"];
for (NSInteger i = 0; i < [himo count]; i++) {
    NSDictionary *item = (NSDictionary *)[himo objectAtIndex:i];
    Cell *rowController = [_table rowControllerAtIndex:i];
    [rowController.label setText:@"hi"]; // you probably want to use the data from item here
}
2
  • It stopped crashing now thankfully by doing that, but now it is giving me the error: Error - unable to instantiate row controller class. It also is not changing the text... Mar 1, 2015 at 3:09
  • Did you set the class and identifier correctly for your row controller in your storyboard?
    – rick
    Mar 1, 2015 at 3:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.