Re: SOLVED Re: SIGTRAP on adding object to mutable array
Re: SOLVED Re: SIGTRAP on adding object to mutable array
- Subject: Re: SOLVED Re: SIGTRAP on adding object to mutable array
- From: "Shawn Erickson" <email@hidden>
- Date: Tue, 11 Sep 2007 15:58:12 -0700
On 9/11/07, Daniel Child <email@hidden> wrote:
> That's what I would have expected, but during debugging,
> wordObjects had an address and was listed as having 0 objects.
>
> However, your suggesting I look these over helped me uncover the error.
> I had declared the instance variables to be of one type and actually
> allocated memory for another type. Amazingly, XCode did not catch this or
> even generate a warning.
-[NSObject init] has a return type of id which is effectively
type-less (it can point to any object). It is valid to assign a value
of type id to any object ivar regardless of that ivars type.
I don't see how you got the failure reported earlier given the code
you posted here. You should have gotten an exception outlining an
attempt to send an addObject: message to an instance of
NSMutableDictionary which doesn't support such a message. It sounds
like some other issues was corrected around the same time you noticed
you allocated an object of the wrong type.
-Shawn
_______________________________________________
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