• 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: Adam Raney <email@hidden>
  • Date: Wed, 3 Aug 2005 14:35:41 -0500

I knew it was something simple. Thanks all, NSNumber does the trick.

On Aug 3, 2005, at 2:22 PM, Charilaos Skiadas wrote:

Or to put it another way, you can only put NSObjects in NSArrays.
On Aug 3, 2005, at 1:56 PM, Ian was here wrote:


try    [[myObject addObject:[NSNumber
numberWithInt:myInt]];




--- Adam Raney <email@hidden> wrote:



I am showing my lack of knowledge of ObjC here, but
I'm learning.

I am trying to insert an int into an NSMutableArray,
but getting an
error.

My int is an instance variable of my controller
class. I am trying to
add the int to an instance variable NSMutableArray
of another class
(already properly instantiated) through this process

[myObject addItemToArray: myInt];

Which in turn calls this method:
- (void) addItemToArray: (id) newItem
{
   [myArray addObject: newItem];
}

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?
 _______________________________________________
Do not post admin requests to the list. They will be
ignored.
Cocoa-dev mailing list
(email@hidden)
Help/Unsubscribe/Update your Subscription:



40yahoo.com



This email sent to email@hidden







____________________________________________________
Start your day with Yahoo! - make it your home page
http://www.yahoo.com/r/hs

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


This email sent to email@hidden



Haris




_______________________________________________ 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: 
 >Re: Inserting an (int) into an NSMutableArray (From: Ian was here <email@hidden>)
 >Re: Inserting an (int) into an NSMutableArray (From: Charilaos Skiadas <email@hidden>)

  • Prev by Date: Re: Random number generator
  • Next by Date: Re: NSValueTransformer for selectedObjects controller key - bug?
  • Previous by thread: Re: Inserting an (int) into an NSMutableArray
  • Next by thread: Re: Inserting an (int) into an NSMutableArray
  • Index(es):
    • Date
    • Thread