Mac OS X Reference Library Apple Developer
Search

Deprecated NSArray Methods

A method identified as deprecated has been superseded and may become unsupported in the future.

Deprecated in Mac OS X v10.6

getObjects:

Copies all the objects contained in the receiver to aBuffer. (Deprecated in Mac OS X v10.6.)

- (void)getObjects:(id *)aBuffer

Parameters
aBuffer

A C array of objects of size at least the count of the receiver.

Discussion

The method copies into aBuffer all the objects in the receiver; the size of the buffer must therefore be at least the count of the receiver multiplied by the size of an object reference, as shown in the following example (note that this is just an example, you should typically not create a buffer simply to iterate over the contents of an array):

NSArray *mArray = // ...;
id *objects;
 
NSUInteger count = [mArray count];
objects = malloc(sizeof(id) * count);
 
[mArray getObjects:objects];
 
for (i = 0; i < count; i++) {
    NSLog(@"object at index %d: %@", i, objects[i]);
}
free(objects);
Availability
  • Available in Mac OS X v10.0 and later.
  • Deprecated in Mac OS X v10.6.
Declared In
NSArray.h



Last updated: 2010-04-29

Did this document help you? Yes It's good, but... Not helpful...