Instruments 显示以下代码泄漏,如果我注释掉此代码,则没有泄漏。
NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] init];
// Edit the entity name as appropriate.
NSEntityDescription *entity = [NSEntityDescription entityForName:USER_CORE_DATA inManagedObjectContext:self.managedObjectContext];
[fetchRequest setEntity:entity];
NSPredicate *predicte = [NSPredicate predicateWithFormat:@"username == %@", [[User defaultManager] savedUsername]];
[fetchRequest setPredicate:predicte];
// set any predicates or sort descriptors, etc.
// execute the request
[self.managedObjectContext executeFetchRequest:fetchRequest onSuccess:^(NSArray *results) {
} onFailure:^(NSError *error) {
NSLog(@"Error fetching: %@", error);
}];
[fetchRequest release];
具体而言,仪器在上面的代码中说明了这一行:
[self.managedObjectContext executeFetchRequest:fetchRequest onSuccess:^(NSArray *results)
它似乎是 fetchRequest 和/或块的泄漏。任何帮助将不胜感激,并提前致谢。