• 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: Inserting an (int) into an NSMutableArray
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Inserting an (int) into an NSMutableArray


  • Subject: Re: Inserting an (int) into an NSMutableArray
  • From: Andy Lee <email@hidden>
  • Date: Wed, 3 Aug 2005 15:08:15 -0400

On Aug 3, 2005, at 2:32 PM, Adam Raney wrote:
I get the following error in the debugger:

[NSCFArray addObject:]: attempt to insert nil

I know this is some stupid rookie mistake, that I am missing some fundamental understanding here, but could someone be so kind as to point out the flaw of sending an int directly in such a manner?

Scalar data types like int, char, and float are not objects. NSMutableArray and its related collection classes contain objects, so that's the only kind of argument you should pass to -addObject: etc.


One way to create an array of integers is to use the wrapper class NSNumber.

--Andy

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >Inserting an (int) into an NSMutableArray (From: Adam Raney <email@hidden>)

  • Prev by Date: Re: Inserting an (int) into an NSMutableArray
  • Next by Date: Re: Inserting an (int) into an NSMutableArray
  • Previous by thread: Re: Inserting an (int) into an NSMutableArray
  • Next by thread: Re: Inserting an (int) into an NSMutableArray
  • Index(es):
    • Date
    • Thread