Re: Another basic CoreData question
Re: Another basic CoreData question
- Subject: Re: Another basic CoreData question
- From: email@hidden
- Date: Sat, 10 Jul 2010 05:22:46 +1200
Thanks for the help guys. I have this working now, along with the double items. Is there any way to avoid/workaround this problem. Or rather another way to get a reference to the departments?
Cheers
Rob
On 10/07/2010, at 2:26 AM, Sean McBride wrote:
> On Fri, 9 Jul 2010 05:12:10 -0700, Jerry Krinock said:
>
>>>> Using the standard Employee/Department example, Whats the best way to
>> set a default department for an Employee?
>>>> So that every employee is created with a relationship to the
>> "mailRoom" department.
>>>
>>> Probably to add some custom code to AwakeFromInsert in your employee
>> NSManagedObjectSubclass to set its own department.
>>
>> Yes, that works.
>
> Agreed, but it can be tricky. How, from Employee's awakeFromInsert, do
> you get the default Department? One way would be to fetch. I do this
> and it's generally fine, except for a bug in NSArrayController:
>
> 6723165 fetching in awakeFromInsert causes 2 notifications to
> NSArrayController
>
> Looks like this is actually mentioned in awakeFromInsert's docs now. Nice!
>
> So if you have a tableview (bound to an array controller) of Employees,
> adding a new Employee will result in two items in the table (but not
> your model).
>
> --
> ____________________________________________________________
> Sean McBride, B. Eng email@hidden
> Rogue Research www.rogue-research.com
> Mac Software Developer Montréal, Québec, Canada
>
>
> _______________________________________________
>
> Cocoa-dev mailing list (email@hidden)
>
> 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:
>
> This email sent to email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden