Low Level (mid-level) Core Data problems
Low Level (mid-level) Core Data problems
- Subject: Low Level (mid-level) Core Data problems
- From: Barry Wilson <email@hidden>
- Date: Mon, 15 May 2006 18:31:12 -0700
Hi,
I have a core data application that I am going to populate with data
by parsing text files. I've already built an application in Cocoa and
tested *most* of the user interface - at least the part that's
relevant to my current task.
So I decided to use a command line program to parse and build the
document following more or less the Low Level Core Data tutorial
except for the part where the managed object model is created
manually I used:
mom = [[NSManagedObjectModel alloc] initWithContentsOfURL:)modelURL];
where modelURL refered to the model in my application's bundle (which
is where this command line tool is as well) .
I created the context with the file name I want for the document.
Everything seemed to be going ok until the part where I actually
created objects and inserted them into the context. Except for the
fact that it is in a function instead of the main.c, my code looks
essentially like the code in the tutorial:
NSEntityDescription *kwEntity = [[managedObjectModel()
entitiesByName] objectForKey:@"Keyword"];
Keyword *kw = [[[Keyword alloc] initWithEntity:kwEntity
insertIntoManagedObjectContext:managedObjectContext()] autorelease];
[kw setValue:(NSString *) keyword forKey:@"name"]; // can't setValue
because kw is null
Basically the kw object is always null. I've checked the entity and
it appears OK, and I have used the Cocoa application to insert these
same kinds of objects. The file I am creating shows up (but empty),
so I am pretty sure the context is setup ok. So I am wondering why I
can't alloc an object there. Is there some conflict? (I am also using
yacc and lex with my YYSTYPE defined as CStringRef's which seems to
work alright.).
I've looked at everything I can think of and I must be missing
something really obvious. Any ideas?
-Barry
_______________________________________________
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