You are still having the same error.

All your objects in the relationships are fetched. Therefore they are owned by the NSManagedObjectContext. You kill the NSManagedObjectContext by releasing it. After that point you are not allowed to touch any of its fetched objects. But you hand them out inside the NSDictionary.

Pleas reconsider my first tip and let the calling method create the NSManagedObjectContext. Use that to fetch all your objects, process them and _then_ kill your NSManagedObjectContext.

An NSManagedObject can not live without its NSManagedObjectContext. The NSManagedObjectContext ist the bucket that holds it. You can not take it out and throw the bucket away. Will not work.

        atze



Am 01.05.2009 um 10:24 schrieb Daniel Kennett:


NSManagedObjectContext *context = [[NSManagedObjectContext alloc] init];
        
Pet *pet = [KNClarusQuickDocumentParser petAtURL:url inContext:context];
        
NSMutableDictionary *dict = [[NSMutableDictionary alloc] init];

[dict setValue:[[[pet valueForKey:@"name"] copy] autorelease] forKey:@"name"]; [dict setValue:[[[pet valueForKey:@"birthday"] copy] autorelease] forKey:@"birthday"];
// More copying of strings and dates
[..]
[dict setValue:[[[pet valueForKey:@"pertinentActions"] copy] autorelease] forKey:@"pertinentActions"]; // <--- Here

[context release];

^^^^^^^^^^^^^^^^^ this release kills all fetched objects.

        
return [dict autorelease];

^^^^^^^^^^^^^^^^^ this dict contains dead objects.


_______________________________________________

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