• 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
NSArray or MutableArray Null/NIL placeholder
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSArray or MutableArray Null/NIL placeholder


  • Subject: NSArray or MutableArray Null/NIL placeholder
  • From: Vince Ackerman <email@hidden>
  • Date: Wed, 30 May 2007 07:48:11 -0700

I need to have an array of 16 (id) objects. When I create them, I want to keep them in a specific order at a specific index in the array. If I dispose of the object, I want the index in the array to be empty, not back filled by the next object as suggested by the docs. I want to be able to test the index to see if any object is currently at that index. My question is this: Somewhere I read that you can't insert a nil object into NSArray? What would I use as a placeholder that would indicate an empty slot in the array? Would null work?


Searching the docs for NSMutableArray doesn't seem to give me an answer. All the methods seem to avoid leaving an empty index.


Also, do I need to retain/release an object when inserting/deleting the object in an Array, or does NSArray do this automatically?

Maybe I'm misunderstanding nil/null.

Thanks in advance for any help.


Vince

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: NSArray or MutableArray Null/NIL placeholder
      • From: Mike Abdullah <email@hidden>
    • Re: NSArray or MutableArray Null/NIL placeholder
      • From: Charles Steinman <email@hidden>
  • Prev by Date: Re: how to access a c++ vector member of an objc class?
  • Next by Date: Re: NSArray or MutableArray Null/NIL placeholder
  • Previous by thread: Re: refreshing core data controller
  • Next by thread: Re: NSArray or MutableArray Null/NIL placeholder
  • Index(es):
    • Date
    • Thread