导致Apple Watch崩溃的表



当我试图用以下代码启动我的apple watch应用程序时,它在日志打印"product"后崩溃(之后什么都没有)。当我删除代码时,它不会崩溃。我不知道出了什么问题。

 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");

看起来您将要在表中显示的数据与行控制器类型混合在一起。如果你只有一个单行控制器类型的Cell,它似乎是你通过你的代码做到的,你想要以下:

[_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
}

最新更新