You're not calling [[numbers alloc] init];

at the point when you try to addObject you're sending a message to nil, which is acceptable under Objective-C
On 17-Jun-08, at 5:02 PM, Daniel Richman wrote:

I've got an object which has an NSMutableArray as an instance variable. If, in one of my methods, I try to call
[myArray addObject:@"this is a test"];       (for example),

I get no error, but the object isn't added. If I try to do
[myArray objectAtIndex:0];
I get (null), and
[myArray count];
returns zero.

However, if I just declare the NSMutableArray inside one of the methods of the object, everything works fine. However, this is clearly not an optimal solution because the array is destroyed after the method finishes executing.

I posted a sample project at http://danielrichman.com/tmp/NSMutableArray_Problem.tar.gz .

Thanks!
Daniel
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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/rob.kukuchka %40mac.com

This email sent to [EMAIL PROTECTED]

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to