Re: Core Data data access
Re: Core Data data access
- Subject: Re: Core Data data access
- From: Wain <email@hidden>
- Date: Thu, 30 Mar 2006 20:46:40 +0100
Hi,
You really need to supply more info, what works fine?
The exception tells you that your code snippet gets all of the
'Device' entities for you but you are requesting a value which is
undefined.
Do you think 'Device' should have a value for 'PropertyName'?
What are you trying to achieve?
(additionally you should check for errors from your fetch request
execution)
Wain
On 30 Mar 2006, at 20:31, Dan Grassi wrote:
I have started a simple project with a code less Core Data
application that used a SQLite DB backend. Everything works fine.
Now I want to access the data and am having no luck. I have tried:
NSDictionary* entities = [managedObjectModel entitiesByName];
NSEntityDescription* entity = [entities valueForKey:@"Device"];
NSFetchRequest* fetch = [[NSFetchRequest alloc] init];
[fetch setEntity: entity];
NSArray* results = [managedObjectContext executeFetchRequest:fetch
error:nil];
NSEnumerator *enumerator = [results objectEnumerator];
NSManagedObject* managedObject;
while (managedObject = [enumerator nextObject])
NSLog(@"PropertyName : %@", [managedObject
valueForKey:@"PropertyName"]);
I get:
2006-03-30 14:28:24.440 ProjectName[11524] Exception raised during
posting of notification. Ignored. exception: [<NSManagedObject
0x3e0510> valueForUndefinedKey:]: this class is not key value
coding-compliant for the key PropertyName.
Surely it must be easy to get the data and even the property names.
Can someone please help?
Dan
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden