Reputation: 1378
I am trying to add objects to an NSMutableArray (it has been properly alloced and inited). After running addObject, the debugger says the array has the correct number of elements in it, but all of the elements are pointing to 0x0 . I cannot access the elements later in the program. the screenshot is here
http://imageshack.us/photo/my-images/818/screenshot20110801at344.png/
what am I missing?
note that the "storm" object that gets added to the array looks good in the debugger...
thanks!
Upvotes: 2
Views: 1087
Reputation: 3291
From the code you've posted, everything looks fine. If you were overreleasing you wouldn't have nilled out pointers in the array, and you have two elements which makes sense seeing as you call addObject: twice. The one thing that might be wrong is your initialisation of the cycloneDatabase array. Check you're initialising it correctly cycloneDatabase = [[NSMutableArray alloc] init]
. I can't say I've ever seen this one before though.
P.S. Slight nitpick, you shouldn't use get* in methods, like your getCycloneWithName:. get* implies you are returning by reference, which in this case you aren't, so it should really be just cyloneWithName: :)
Upvotes: 4