In the latest version of my music player, I'm doing a lookup on Tracks with this predicate
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"NOT (ANY genreRel.status_date <= status_date)"];
Checking the returned data with
for (Track *trk in fetchController.fetchedObjects){
for(Genre *gen in trk.genreRel){
if([trk.status_date timeIntervalSinceNow] >= [gen.status_date timeIntervalSinceNow]){
NSLog(@"Should not have been returned. track date %@, genre date %@ %@", trk.status_date, gen.status_date);
}
}
}
Ended up with over a thousand of messages like this.
016-01-28 09:44:58.040 FMA Player[323:15902] Should not have been returned. track date 2016-01-28 14:36:12 +0000 genre date 2015-10-20 21:16:47 +0000
Is there a flaw in my predicate? Or a bug in the Core Data process? Any suggestions for a predicate that will do this reliably?
Thanks,
Jonathan
why do you have the ANY in there when there’s only one argument being run?
by the look of it, you might just want to say "genreRel.status_date <= status_date” ?
not that I understand what’s wrong, but you can easily test a predicate using an array in a sandbox or debugger which might help you get the exact predicate format you need.
> On Jan 28, 2016, at 10:27 AM, Jonathan <jonath...@gmail.com> wrote:
>
> Hello,
>
> In the latest version of my music player, I'm doing a lookup on Tracks with this predicate
>
> NSPredicate *predicate = [NSPredicate predicateWithFormat:@"NOT (ANY genreRel.status_date <= status_date)"];
>
> Checking the returned data with
>
> for (Track *trk in fetchController.fetchedObjects){
> for(Genre *gen in trk.genreRel){
> if([trk.status_date timeIntervalSinceNow] >= [gen.status_date timeIntervalSinceNow]){
> NSLog(@"Should not have been returned. track date %@, genre date %@ %@", trk.status_date, gen.status_date);
> }
> }
> }
>
> Ended up with over a thousand of messages like this.
>
> 016-01-28 09:44:58.040 FMA Player[323:15902] Should not have been returned. track date 2016-01-28 14:36:12 +0000 genre date 2015-10-20 21:16:47 +0000
>
> Is there a flaw in my predicate? Or a bug in the Core Data process? Any suggestions for a predicate that will do this reliably?
>
> Thanks,
> Jonathan
>
>
>
> --
> You received this message because you are subscribed to the Google Groups "iPhone SDK Development" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to iphonesdkdevelopment+unsub...@googlegroups.com.