Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/xcode/7.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Xcode 我的tableview在滚动时崩溃_Xcode_Class_Global Variables - Fatal编程技术网

Xcode 我的tableview在滚动时崩溃

Xcode 我的tableview在滚动时崩溃,xcode,class,global-variables,Xcode,Class,Global Variables,我不理解。。。我成功地填充了我的表视图,但是当我滚动它时,它会崩溃而没有消息 我使用NSMutablearray创建我的tabQuestion,然后将其添加到我的委托中:cellforrowatinexpath NSDictionary *question = [self.tabQuestion objectAtIndex:indexPath.row]; [cell setAccessoryType: UITableViewCellAccessoryDisclosureIndicator

我不理解。。。我成功地填充了我的表视图,但是当我滚动它时,它会崩溃而没有消息

我使用
NSMutablearray
创建我的
tabQuestion
,然后将其添加到我的委托中:
cellforrowatinexpath

NSDictionary    *question = [self.tabQuestion objectAtIndex:indexPath.row];

[cell setAccessoryType: UITableViewCellAccessoryDisclosureIndicator];

cell.textLabel.text = [NSString stringWithFormat:@"%@", [question objectForKey:@"question"]];
cell.detailTextLabel.text =  [NSString stringWithFormat:@"%@", [question objectForKey:@"reponse"]];

if ([[question objectForKey:@"bOk"] isEqualToString:@"1"]) {
        cell.imageView.image = [UIImage imageNamed:@"ok.png"];
}
else
{
        cell.imageView.image = [UIImage imageNamed:@"ok.png"];   
}

[question release];



return cell;

您不应该
释放通过
NSArray
objectAtIndex:
方法返回的
对象。这种情况很少发生

尝试删除所有行中的第一行:
[question release]


然后检查您的
self.tabQuestion
是否包含所需数量的对象。

如果我只添加这些行,则会出现崩溃->NSLog(@“%@%i”,[tabQuestion description],indexPath.row);NSLog(@“%@,[[self.tabQuestion objectAtIndex:indexPath.row]说明];索引(15)超出边界(0)我找到了解决方案。事实上,系统会自动释放我的对象。我用保留法解决它。