我收到错误
线程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;
}
答案 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;
}