オブジェクトの配列を取得するコードは次のとおりです。
-(BOOL)isAvailable:(NSString*)aName
{
BOOL isAvailable = NO;
NSEntityDescription *ed = [Queue entityInManagedObjectContext:moc];
NSFetchRequest *fr = [[NSFetchRequest alloc] init];
[fr setEntity:ed];
NSPredicate *pr = [NSPredicate predicateWithFormat:@"textName == %@", aName];
[fr setPredicate:pr];
NSArray *arr = [moc executeFetchRequest:fr error:nil];
if ([arr count] > 0) {
isAvailable = YES;
}
return isAvailable;
}
メモリリークは次の場所にあります:
NSArray *arr = [moc executeFetchRequest:fr error:nil];
この行をコメントしても漏れはありません。私はARCプロジェクトを使用しています。