Maybe you can help me. What is wrong with this code:
-(NSMutableArray *)returnItemsWithName:(NSString *)name{
NSFetchRequest *fetch=[[NSFetchRequest alloc] init];
NSEntityDescription *entity=[NSEntityDescription entityForName:@"XYZ" inManagedObjectContext:[self managedObjectContext]];
[fetch setEntity:entity];
NSDate *sevenDaysAgo = [appDelegate dateByAddingDays:-7 toDate:[NSDate date]];
NSPredicate *pred= [NSPredicate predicateWithFormat:[NSString stringWithFormat:@"originTime >= %@", sevenDaysAgo]];
[fetch setPredicate:pred];
NSError *fetchError=nil;
NSMutableArray *fetchedObjs = [[[self managedObjectContext] executeFetchRequest:fetch error:&fetchError] retain];
if (fetchError!=nil) {
return nil;
}
return fetchedObjs;
}
line
fetchedObjs = [[[self managedObjectContext] executeFetchRequest:fetch error:&fetchError] retain];
failure:
* Application termination due to the uncaught exception "NSInvalidArgumentException", reason: "Unable to parse a string of the format" originTime> = 2011-02-28 21:07:37 +0000 "'
All objects are NOT zero, and also originDate is an NSDate in the CD database
source
share