I have a Core Data app with an entity that contains a date attribute, called startTime. I have a predicate defined as startTime >= "today". If I apply that predicate to an array controller using setFilterPredicate, it works fine. However, if I use the same predicate with NSFetchRequest, it does not work (returns an empty array). My code for fetching the data using a NSFetchRequest is below. Why does this predicate work with an array controller but not with a fetch request? All other predicates I have used work with both the array controller and the fetch request. Just not when the predicate is defined as startTime >= "today". Does anyone know why?

+(NSArray *)objectsForEntityName:(NSString *)name
                predicate:(NSPredicate*)predicate
                inContext:(NSManagedObjectContext *)context
{
        NSEntityDescription *entity = [NSEntityDescription entityForName:name
                        inManagedObjectContext:context];
        NSFetchRequest *req = [[[NSFetchRequest alloc] init] autorelease];
        [req setEntity:entity]; 
        [req setPredicate:predicate];
        
        NSError *error = nil;
        NSArray *array = [context executeFetchRequest:req error:&error];    
        return array;
}

Thanks in advance,
Kimo

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to