Ios CellForRowatineXpath中对象的潜在泄漏

Ios CellForRowatineXpath中对象的潜在泄漏,ios,objective-c,automatic-ref-counting,xcode4.5,Ios,Objective C,Automatic Ref Counting,Xcode4.5,我因以下代码而违反上述规定: - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *simpleTableIdentifier = @"Cell"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:

我因以下代码而违反上述规定:

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *simpleTableIdentifier = @"Cell";

    UITableViewCell *cell = [tableView   dequeueReusableCellWithIdentifier:simpleTableIdentifier];

    if (cell == nil) {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:simpleTableIdentifier];
    }



        cell.textLabel.text = [mapContacts objectAtIndex:indexPath.row];
    NSLog(@"%@",cell.textLabel.text);
    cell.detailTextLabel.text = [number objectAtIndex:indexPath.row];



        return cell;


}

违规显示在
返回单元格可以采取什么措施来补救此问题?请帮忙。我将XCode 4.5与ARC一起使用。

您显然没有使用ARC(至少在编译单元/文件中)

这:

导致手动参考计数(=非ARC)中的(潜在)泄漏。您需要在此行末尾添加自动释放:

cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:simpleTableIdentifier] autorelease];
或者只需确保ARC已正确启用(请在
构建阶段)

您显然没有使用ARC(至少在编译单元/文件中)

这:

导致手动参考计数(=非ARC)中的(潜在)泄漏。您需要在此行末尾添加自动释放:

cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:simpleTableIdentifier] autorelease];
或者只需确保ARC已正确启用(请在
构建阶段)

是否确实使用ARC编译此文件?这听起来像是当您忘记在
[UITableViewCell alloc
尝试运行clean并再次检查。Product/clean从顶部菜单或Shift+Command+K。此外,即使项目使用ARC,也请确保未为单个文件设置无ARC标志。您可以在目标->构建阶段->编译源代码中检查单个文件。标志的名称为
-fno objc ARC
.thanks all..问题已经解决:)你确定这个文件是用ARC编译的吗?这听起来像是一个错误,当你忘记在
[UITableViewCell alloc
尝试运行clean并再次检查。Product/clean从顶部菜单或Shift+Command+K。此外,即使项目使用ARC,也请确保未为单个文件设置无ARC标志。您可以在目标->构建阶段->编译源代码中检查单个文件。标志的名称为
-fno objc ARC
.t汉克斯所有..问题已经解决:)非常感谢…没有弧的文件非常感谢…没有弧的文件