仪器显示以下代码泄漏,如果我注释掉这段代码,就不会有泄漏。
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 和/或块存在泄漏。 感谢您提前的任何帮助。