On Apr 16, 2009, at 10:04 PM, David Zwerdling wrote:
A while ago I wrote a simple application in which users create and manipulate CoreData entities named "DataSets".

It is good to use the appropriate terminology.
Users don't "create and manipulate CoreData entities"; you define the entities via the managed object model. Users then create and manipulate managed objects.

Typically entity names are in the singular, and describe the type of thing they represent.

I used the document preset so I didn't have to deal with any of the file writing stuff.

It's not clear exactly what you mean here, but judging by the next code fragment you appear to be abusing the document architecture. Assuming this is the case, it doesn't really help, and since the basic Core Data application template contains all the "file writing stuff" you need, doesn't save you much anyway.

Anyways, I'm writing a new application that uses these data sets. Users save the file from the prior application and can "import" data sets into this new application. At least, hypothetically at this point. The issue is, when using code like this (url points to a document full of data sets):
        NSPersistentDocument *pd = [NSPersistentDocument new];
BOOL success = [pd configurePersistentStoreCoordinatorForURL:url ofType:NSXMLStoreType modelConfiguration:nil storeOptions:nil error:&error];
        NSSet *ros = [[pd managedObjectContext] registeredObjects];

Following on from the preceding, it's not clear why you're creating a persistent document.
Is this to be presented to the user?

success comes back true, but there are no managed objects in 'ros'.

At this stage, you haven't fetched any objects:

"The framework tries to be as efficient as possible. Core Data is demand driven, so you don't create more objects than you actually need. The graph does not have to represent all the objects in the persistent store. Simply specifying a persistent store does not bring any data objects into the managed object context." <http://developer.apple.com/documentation/Cocoa/Conceptual/CoreData/Articles/cdBasics.html#//apple_ref/doc/uid/TP40001650-207422-TPXREF147 >


So, is there some sample code I can see which loads the managed objects of an xml file? I've looked pretty exhaustively and everything seems too high level (relying on the single-file model that I implemented in my original application.) Am I missing something silly?

Probably the above. It's also not clear what you mean by "everything seems too high level (relying on the single-file model that I implemented in my original application)".

mmalc


_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to