よろしくお願いします。しかし、深刻なことに、私のコードで漏れがどこから来ているのか分かりません。それを楽器で動かしても漏れは見えませんが、分析すると警告しています。疑わしいコードは次のとおりです。このコードのリークはどこにありますか?私は配管工と呼ぶことができますか?
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *tableIdentifier = @"Table";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:tableIdentifier];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:tableIdentifier];
}
NSUInteger row = [indexPath row];
if (cityCount >= 1) {
NSString *city = [NSString stringWithFormat:@"%@, %@, %@",
[[cityData objectAtIndex:row] objectAtIndex:0],
[[cityData objectAtIndex:row] objectAtIndex:1],
[[cityData objectAtIndex:row] objectAtIndex:2]
//,[[cityData objectAtIndex:row] objectAtIndex:3]
];
cell.textLabel.text = city;
cell.textLabel.font = [UIFont boldSystemFontOfSize:14];
return cell;
}
else {
cell.textLabel.text = @"No cities were found";
cell.textLabel.font = [UIFont boldSystemFontOfSize:14];
cell.textLabel.textAlignment = UITextAlignmentCenter;
cell.selectionStyle = UITableViewCellSelectionStyleNone;
return cell; //Here's the warning
//Potential leak of an object allocated on line 64 and stored into 'cell'
}
}
うん!ありがとう! –
私はARCと同じ問題があります。それでも私はそれを自動リリースする必要があります。助けてください。 – UserDev