【发布时间】:2011-02-19 11:22:14
【问题描述】:
我在我的应用程序中看到以下错误:
(4446,0xa0bc94e0) malloc: * 对象 0x1d153000 错误:指针 被释放没有被分配 * 在 malloc_error_break 中设置断点进行调试
这个错误是什么意思?
我正在尝试在表格视图中显示 2000 个地址,并在以下代码中使用 cellForRowAtIndexPath 看到该错误:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil)
{
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
}
obdata = [AddressBookData alloc];
obdata = [arrayLocalAddressbook objectAtIndex:indexPath.row];
// Set button Tag
cell.textLabel.text = [NSString stringWithString:obdata.lastname];
return cell;
}
// Customize the number of sections in the table view.
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
//return [indexArray count];
return 1;
}
// Customize the number of rows in the table view.
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return [arrayLocalAddressbook count];
}
这可能是什么原因造成的?
【问题讨论】: