NSFetchRequest autoreleased with no pool in place - just leaking
First off I have to say this website and its members are amazing in their responses. Most helpful. thank you.
Secondly, I am troubleshooting the following error while troubleshooting an iPhone/iPad app that I am working on:
NSFetchRequest autoreleased with no pool in place - just leaking.
the culprit code seems to be
NSFetchRequest *request = [[NSFetchRequest alloc] init];
found in this method
-(NSArray *)searchDatabase:(int)uniqueID withPredicate:(NSString *)pred{
NSLog(@": DetailViewController/searchDatabase() method...executing. ");
NSLog(@": DetailViewController/searchDatabase() pred = %@",pred); // returns ParentID
NSError *error = nil;
NSEntityDescription *entity = [NSEntityDescription entityForName:@"Directory" inManagedObjectContext:self.man开发者_如何学PythonagedObjectContext];
//: moved above line
NSPredicate *predicate = [NSPredicate predicateWithFormat:[NSString stringWithFormat:@"%@=%@", pred, [NSNumber numberWithInt:uniqueID]]];
NSFetchRequest *request = [[NSFetchRequest alloc] init];
[request setReturnsObjectsAsFaults:NO];
[request setEntity:entity];
[request setPredicate:predicate];
//: get the session and update the record with the time it ended
NSArray *mutableFetchResults = [self.managedObjectContext executeFetchRequest:request error:&error];
NSLog(@": DetailViewController/searchDatabase() mutableFetchResults = %@",mutableFetchResults);
[request release];
[error release];
NSLog(@": DetailViewController/searchDatabase() method...terminating.");
return mutableFetchResults;
}
I am not sure if the release statements are properly set up, but even still I am unsure while the error shows up in the first place. I am a little new to objective c, and at compile time the application did not indicate any errors (the message shows up at runtime).
If anyone can help me out with this, it would be most appreciated.
thanks
Edward
精彩评论