In Objective-C, I need to initialize an array of nulls/nil ( not sure which one to use ).
I have this code:
NSMutableArray * ObjectIndex = [[NSMutableArray alloc] initWithCapacity:maxObjectId];
for ( int i = 0; i < maxObjectId; i++ )
{
[ObjectIndex setObject:nil atIndexedSubscript:i];
}
I'm getting an error stating that object cannot be nil.
I plan on using this array to store objects in at certain indexes, leaving others nil(null?)
Later in the code:
for (Object * obj in objs)
{
ObjectIndex[obj.ID] = obj;
}