首先,我必须说这个网站及其成员的回答非常棒。最有帮助的。谢谢。
其次,我正在对我正在处理的iPhone / iPad应用程序进行故障排除时排除以下错误:
NSFetchRequest自动释放,没有游泳池 - 只是漏水。
罪魁祸首似乎是
NSFetchRequest *request = [[NSFetchRequest alloc] init];
在此方法中找到
-(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.managedObjectContext];
//: 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;
}
我不确定发布声明是否已正确设置,但即使错误显示在首位,我仍然不确定。我对目标c有点新,在编译时应用程序没有指出任何错误(消息在运行时显示)。
如果有人可以帮助我解决这个问题,那将非常感激。
感谢
爱德华