Re: “EXC_BAD_ACCESS” on Custom TableView with custom NSCell when clicking.
Re: “EXC_BAD_ACCESS” on Custom TableView with custom NSCell when clicking.
- Subject: Re: “EXC_BAD_ACCESS” on Custom TableView with custom NSCell when clicking.
- From: Gustavo Pizano <email@hidden>
- Date: Thu, 18 Feb 2010 07:50:39 +0100
On Feb 18, 2010, at 12:29 AM, Ken Ferry wrote:
> On Wed, Feb 17, 2010 at 2:14 PM, Gustavo Pizano <email@hidden> wrote:
>
> On Feb 17, 2010, at 11:03 PM, Jim Correia wrote:
>
> > On Feb 17, 2010, at 4:41 PM, Gustavo Pizano wrote:
> >
> >> Maybe I misunderstood I must conform NSCopying protocol also even when using core data?
> >
> > If you have an NSCell subclass which adds iVars, you must implement -copyWithZone: to do correct memory management.
> >
> > Your -copyWithZone: needs to work correctly within the bounds of the object ownership rules.
> >
> > If you have an object iVar which shouldn’t be copied, but is still an owned reference, then you can (and must) retain it instead in the copy.
> >
> > (You should do this for all cells with iVars, not just ones with object iVars, so that your subclass will behave correctly in the future even if NSCell doesn’t implement its behavior using NSCopyObject.)
> >
> > - Jim
>
> Hello Jim
> HMM digging more into the problem.. definitely it seems because Im not copying properly the NSManagedObject Paul Robinson says in one old post:
>
> "The short answer is that you need to override the setObjectValue: method (which tries to copy your uncopyable NSManagedObject) in your custom NSCell to convert your NSManagedObject into an NSValue (which is copyable)."
>
> Overriding setObjectValue: to mess with the object is almost never right. That sets you up for trouble when the framework use -objectValue vs goes directly to the ivar.
>
> You shouldn't take random weblog posts as necessarily correct.
>
So if this isn't right, and if i have no ivar in my custom NSCell, then, the right way to do this is...
Im gonna check today at work Corbin blog, and see what's causing the early release of the User, then once I know better what's is it I will let you know, maybe that way I can find the solution.
Gustavo
> -Ken
> Cocoa Frameworks
>
>
>
> And taking what you said, so if my User ManagedObject returns me the NSDictionary with the key-value of its attributes, then in the cell I must set it as an ivar within the method setObjectValue, then implement the copyWithZone and return the copy of it isn't it? right now I don't have any ivar in my custom cell.. sooo . := :S.
>
> Gustavo
>
> _______________________________________________
>
> 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