Skip navigation.
 
mlDuplicating NSPersistentDocument Core Data support (was: Core Data & IB in prefs pane ("Cannot perform operation without a managed object context"))
FROM : Rick Mann
DATE : Fri Mar 28 21:43:55 2008

I figured out my problem. There is, in fact, support in 
NSPersistentDocument for Core Data. I'd like to replicate that support 
in my prefs pane class. The managedObjectModel: getter talks about 
how, by default, "the Core Data framework creates a merged model from 
all models in the application bundle." How can I just get at this 
model and return it? Perhaps I don't even need to implement this, just 
something that creates a managedObjectContext?

TIA,
Rick


On Mar 28, 2008, at 1:18 PM, Rick Mann wrote:
> I didn't get any responses, so I'm trying again.
>
> I'm clearly missing some link in the whole Core Data thing. I'm 
> trying to use it in a Prefs Pane. I've written no code, just set 
> things up with the data model editor and IB. Is there something 
> NSDocument does to support Core Data that an NSPrefsPane wouldn't do 
> by default?
>
> Basically, when I click my "add" button, although it's wired to 
> NSArrayController's add: action, it doesn't seem to actually add 
> anything. I get "3/28/08 1:17:58 PM System Preferences[7428] Cannot 
> perform operation without a managed object context". I think I get 
> what that's telling me, but how do I set one up?
>
> In the tutorial, it seemed to "just work," and I didn't set anything 
> up explicitly. Thanks!
>
>
> ----------------------------
> Original message:
>
> I'm trying to use what I learned yesterday about Core Data in a 
> System Prefs pane. I created an Entity data model, and then tried to 
> add an NSTable and some buttons and wire them up the same way I'd 
> seen the Core Data Entity tool do it in IB. But, it didn't work.
>
> So I tried using the Core Data Entity tool to let IB do it, and it 
> disables the Add and Remove buttons.
>
> The only difference I can spot is in yesterday's project, the File's 
> Owner is an NSDocument. Today, it's a PrefsPane.
>
> Is it possible to use this stuff in a prefs pane? What am I missing?
>
> Thanks!
>
> --
> Rick
>
> _______________________________________________
>
> Cocoa-dev mailing list (<email_removed>)
>
> 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/<email_removed>
>
> This email sent to <email_removed>


--
Rick

Related mailsAuthorDate
mlCore Data & IB in prefs pane ("Cannot perform operation without a managed object context") Rick Mann Mar 28, 21:18
mlDuplicating NSPersistentDocument Core Data support (was: Core Data & IB in prefs pane ("Cannot perform operation without a managed object context")) Rick Mann Mar 28, 21:43
mlRe: Core Data & IB in prefs pane ("Cannot perform operation without a managed object context") Keary Suska Mar 30, 00:17