Core Data fetch exception: keypath <transient attribute> not found in entity
Core Data fetch exception: keypath <transient attribute> not found in entity
- Subject: Core Data fetch exception: keypath <transient attribute> not found in entity
- From: Fritz Anderson <email@hidden>
- Date: Sun, 12 Jul 2009 14:05:32 -0500
This is on iPhone 3.0, but should be of general applicability.
I have an entity, "Sale," that has a transient attribute "latestDate."
It is marked optional/transient/indexed in the MOM; I've also tried it
without setting optional. I set latestDate in awakeFromFetch and
awakeFromInsert. I use [NSDate dateWithTimeIntervalSinceReferenceDate:
0] as a flag value.
At some point in my application, I want to retrieve all Sales that
don't have that flag value. I do:
=====
NSFetchRequest * fetch = [[NSFetchRequest alloc] init];
fetch.entity = [NSEntityDescription entityForName: @"Sale"
inManagedObjectContext: gMoc];
NSSortDescriptor * sort = [[NSSortDescriptor alloc] initWithKey:
@"latestDate"
ascending: NO];
fetch.sortDescriptors = [NSArray arrayWithObject: sort];
[sort release];
NSPredicate * pred = [NSPredicate predicateWithFormat: @"latestDate !
= %@",
[NSDate dateWithTimeIntervalSinceReferenceDate: 0]];
fetch.predicate = pred;
NSError * error = nil;
NSArray * retval = [gMoc executeFetchRequest: fetch error: &error];
=====
The execute... method raises
'NSInvalidArgumentException', reason: 'keypath latestDate not found in
entity <NSSQLEntity Sale id=2>'
Only one Sale object is in the MOC. awakeFromInsert was called on it
before this fetch is executed. I've searched my project for regular
expressions that should catch most possible misspellings.
This is surely a rookie mistake, but I'm out of ideas. What am I doing
wrong?
— F_______________________________________________
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