• 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
Re: array with int
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: array with int


  • Subject: Re: array with int
  • From: Hua Ying Ling <email@hidden>
  • Date: Wed, 10 Mar 2004 08:50:35 -0500

On Mar 10, 2004, at 8:30 AM, j o a r wrote:

Easy! Integer values are not objects. You can only add Objective-C
objects conforming to the NSObject protocol to Cocoa collections.

j o a r

On 2004-03-10, at 14.20, Sascha Kuehn wrote:

can someone tell me why this not work??
------------------------------------------------------
NSMutableArray *temp = [[NSMutableArray array] retain];
[temp addObject:0];
------------------------------------------------------

You could try using this instead:

// to add
[temp addObject:[NSNumber numberWithInt:0]];

// to read
int tempInt = [[temp objectAtIndex: someIndex] intValue];

~Hua Ying
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.


References: 
 >array with int (From: Sascha Kuehn <email@hidden>)
 >Re: array with int (From: j o a r <email@hidden>)

  • Prev by Date: Cocoa console applications (daemons)
  • Next by Date: Re: Encapsulate C struct/toll-free bridging?
  • Previous by thread: Re: array with int
  • Next by thread: Re: array with int
  • Index(es):
    • Date
    • Thread