任何人帮我解决这个问题1:信号SIGABRT

时间:2012-10-17 08:03:21

标签: iphone ios xcode ipad ios4

我收到错误

  

线程1:信号SIGABRT

这是代码

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{

    /* FOR SIMPLE CELL */
    static NSString *MyIdentifier = @"MyCell";

    UITableViewCell *cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:MyIdentifier];


    cell.accessoryType=UITableViewCellAccessoryDisclosureIndicator;
    word *worddc = [Array objectAtIndex:[indexPath row]]; //ERROR thread 1 signal SIGABRT

        cell.textLabel.text = worddc.word_alphabet;



    return cell;
}

3 个答案:

答案 0 :(得分:0)

检查以下列表:

  • 检查是否仍然分配了数组并且它尚未解除分配。
  • 尝试转换这样的值:

    word *worddc = (word *)[Array objectAtIndex:[indexPath row]];
    

答案 1 :(得分:0)

我评论说你需要解释你的问题,但无论如何我可能有一个想法:

objectAtIndex:会返回(id)对象。尝试将结果转换为单词*:

word *worddc = (word*)[Array objectAtIndex:[indexPath row]];

答案 2 :(得分:0)

尝试这种方式并检查strObj中的内容,是字符串吗?

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{

    /* FOR SIMPLE CELL */
    static NSString *MyIdentifier = @"MyCell";

    UITableViewCell *cell=(UITableViewCell*)[tableView dequeueReusableCellWithIdentifier:MyIdentifier];
    if (cell==nil) 
        cell=[[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:MyIdentifier];

    cell.accessoryType=UITableViewCellAccessoryDisclosureIndicator;
    word *worddc = [Array objectAtIndex:[indexPath row]]; //ERROR thread 1 signal SIGABRT
    NSString *strObj=worddc.word_alphabet;
    cell.textLabel.text =strObj;//Here check what you are getting by setting breakpoint.
    strObj=nil;



    return cell;
}
相关问题