• 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: Strange Managed Context Error
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Strange Managed Context Error


  • Subject: Re: Strange Managed Context Error
  • From: mmalcolm crawford <email@hidden>
  • Date: Sat, 20 Aug 2005 20:02:50 -0700


On Aug 20, 2005, at 7:37 PM, Colin Cornaby wrote:
If you're using a subclass of NSManagedObjectContext then no, it's not done automatically. How have you configured it?


How have you configured the context in the NSPersistentDocument? Put another way, how does the persistent document know to use you NSManagedObjectContext subclass and...

The following is the first part of my init method (the relevent part):
-(id)init{
self = [super init];
//Set up our store co-ordinator using our schema
NSPersistentStoreCoordinator *coordinator
= [[NSPersistentStoreCoordinator alloc] initWithManagedObjectModel:
[[NSManagedObjectModel mergedModelFromBundles:[NSArray arrayWithObjects:[NSBundle bundleForClass:[self class]], nil]] retain]];

[Aside: This will generate a memory leak.

NSManagedObjectModel *model = [NSManagedObjectModel mergedModelFromBundles:
[NSArray arrayWithObject:[NSBundle bundleForClass:[self class]]]];
NSPersistentStoreCoordinator *coordinator =
[[NSPersistentStoreCoordinator alloc] initWithManagedObjectModel: model];
]


//Set this context to use our new store co-ordinator
[self setPersistentStoreCoordinator: coordinator];
The odd NSBundle code is because this code and the schema is within a framework.


... given this init method, how have you set the coordinator for the document?

mmalc

_______________________________________________
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


  • Follow-Ups:
    • Re: Strange Managed Context Error
      • From: Colin Cornaby <email@hidden>
References: 
 >Strange Managed Context Error (From: Colin Cornaby <email@hidden>)
 >Re: Strange Managed Context Error (From: mmalcolm crawford <email@hidden>)
 >Re: Strange Managed Context Error (From: Colin Cornaby <email@hidden>)
 >Re: Strange Managed Context Error (From: mmalcolm crawford <email@hidden>)
 >Re: Strange Managed Context Error (From: Colin Cornaby <email@hidden>)

  • Prev by Date: Re: How to draw a 1 pixel bezierPath
  • Next by Date: Re: using bless to change boot device [yet again]
  • Previous by thread: Re: Strange Managed Context Error
  • Next by thread: Re: Strange Managed Context Error
  • Index(es):
    • Date
    • Thread