• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Adding Custom Objects to a NSMutableArray
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Adding Custom Objects to a NSMutableArray


  • Subject: Adding Custom Objects to a NSMutableArray
  • From: Nick <email@hidden>
  • Date: Sun, 27 Jan 2002 21:41:35 +0700

My sincerest apologies if there is an obvious answer to this question that I have carelessly overlooked, but I can't seem to find what the problem is and would greatly appreciate any help.

I have a custom class called Monopoly Checker. Inside a different set of code, I create 40 of these objects and put them into a NSMutableArray for later access.

The code:
...
MonopolyChecker *temp;
NSNumber *a, *b;
...
a = [NSNumber numberWithInt:1];
b = [NSNumber numberWithInt:3];
array = [NSArray arrayWithObjects:a,b,nil];
temp = [[MonopolyChecker alloc] init];
[temp initializeWith:array Player:playerArray Location:locationArray];
[groups addObject:temp];

where "groups" is an NSMutableArray declared earlier.

For some reason, although this code seems correct to me, the object is never added to the array. I have confirmed that each temp object is created, and can receive messages, but after the addObject: message, the count of the array remains at 0 and no objects inside the array respond to messages sent to them.

I am not receiving any error messages when I add the object or try to access it, but I see no evidence of it being added.

Any help would be greatly appreciated, my apologies again if this newbie question is merely taking up space.

--Nick
email@hidden


  • Follow-Ups:
    • Re: Adding Custom Objects to a NSMutableArray
      • From: Jane <email@hidden>
    • Re: Adding Custom Objects to a NSMutableArray
      • From: Ondra Cada <email@hidden>
  • Prev by Date: Re: How ATTRACTIVE is CoCoa development?
  • Next by Date: Re: Adding Custom Objects to a NSMutableArray
  • Previous by thread: Re: Using one NSWindow to open many NSWindows?
  • Next by thread: Re: Adding Custom Objects to a NSMutableArray
  • Index(es):
    • Date
    • Thread