• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
fetchRequest doesn't give same result as filterPredicate
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

fetchRequest doesn't give same result as filterPredicate


  • Subject: fetchRequest doesn't give same result as filterPredicate
  • From: Martin <email@hidden>
  • Date: Tue, 2 Oct 2007 21:34:25 +0200

Hi,

My Core Data based application has the following data model :
- a "person" entity
- a "file" entity with a "downloadedAt" attribute
- a relationship between the two : person.files <-->> file.person

What I'd like to have is an array of persons that match the following predicate :
"ALL files.downloadedAt == NULL"


The predicate works if it's applied to a NSArrayController using :
[personsController setFilterPredicate:[NSPredicate predicateWithFormat:@"ALL files.downloadedAt == NULL"]];


But it doesn't work when I try to do the same thing with a fetchRequest :

@implementation Person
- (void)test
{
NSFetchRequest *request = [[NSFetchRequest alloc] init];
NSManagedObjectContext *context = [self managedObjectContext];
NSError *err = nil;
NSArray *result;
[request setEntity:[NSEntityDescription entityForName:@"Person" inManagedObjectContext:context]];
[request setPredicate:[NSPredicate predicateWithFormat:@"ALL files.downloadedAt == NULL"]];
result = [context executeFetchRequest:request error:&err];
Log(@"%@",result);
Log(@"%@",err);
[request release];
}
@end


The following code just logs :
()
(null)

Meaning the array is empty and there is no error...
What am I missing ? Why are the two methods giving a different result ?

Many thanks,
Martin.
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Prev by Date: Re: 'kASAppleScriptSuite' undeclared
  • Next by Date: Re: NSCell subclass editing
  • Previous by thread: [JOB] Cocoa Developer, Madison, WI
  • Next by thread: Re: fetchRequest doesn't give same result as filterPredicate
  • Index(es):
    • Date
    • Thread