• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Core Data data access
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >Core Data data access (From: Dan Grassi <email@hidden>)

  • Prev by Date: Opening a window in Core Data application
  • Next by Date: NSView adjustScale: View is scaled but the image remains the same.
  • Previous by thread: Core Data data access
  • Next by thread: Re: Core Data data access
  • Index(es):
    • Date
    • Thread