Error:

New NSArray

NSArray *a = [NSArray array];

New NSArray with objects

NSArray *a = [NSArray arrayWithObjects:@"One", @"Two", @"Three", nil];

New NSArray with one object

NSArray *a = [NSArray arrayWithObject:@"One"];

New NSArray with C array of pointers to objects

NSString *strings[3];
strings[0] = @"First";
strings[1] = @"Second";
strings[2] = @"Third";

NSArray *stringsArray = [NSArray arrayWithObjects:strings count:2];

Read array from file

// file should be created using writeToFile:atomically:
NSArray *a = [NSArray arrayWithContentsOfFile:@"/path/to/file"];

Read array from URL

// file should be created using writeToURL:atomically:
NSArray *a = [NSArray arrayWithContentsOfURL:url];

Check if the array contains given object

BOOL containes = [array containsObject:@"One"];

Number of elements in the array

NSUInteger elements = [array count];

First element of the array

id obj = [array firstObject];

Last element of the array

id obj = [array lastObject];

Get object at index in the array

id obj = [array objectAtIndex:1];

Array of objects at indexes

NSArray *array = [NSArray arrayWithObjects:@"1", @"2", @"3", @"4", @"5", nil];
NSArray *subarray = [array
                         objectsAtIndexes:[NSIndexSet indexSetWithIndexesInRange:NSMakeRange(2, 2)]];
// result is ("3", "4")

Find object in the array with the same value

// compares all obect with given using isEqual: message
NSUInteger idx = [array indexOfObject:@"1"];

Find object in the array with the same address

NSUInteger idx = [array indexOfObjectIdenticalTo:@"1"];

Find object in the array using predicate

NSArray *array = [NSArray arrayWithObjects:@"1", @"22", @"33", nil];

// Result is 1
NSUInteger idx = [array indexOfObjectPassingTest:^BOOL(id obj, NSUInteger idx, BOOL *stop) {
    if ([obj length] > 1)
        return YES;
    else
        return NO;
}];

Find all object in the array using test block

NSArray *array = [NSArray arrayWithObjects:@"1", @"22", @"33", nil];

// Result is 1-2
NSIndexSet* idxSet = [array indexesOfObjectPassingTest:^BOOL(id obj, NSUInteger idx, BOOL *stop) {
    if ([obj length] > 1)
        return YES;
    else
        return NO;
}];

Perform selector on every object in the array

[array makeObjectsPerformSelector:@selector(ping)];

Perform selector with argument on every object in the array

[array makeObjectsPerformSelector:@selector(ping:) withObject:self];

Enumerate objects in the array using block

[array enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop){
    // Do something useful
}];

Find common element in two arrays

id obj = [array firstObjectCommonWithArray:anotherArray];

Check if two arrays are identical

BOOL equal = [array isEqualToArray:anotherArray];

Append object to immutable array

NSArray *newArray = [array arrayByAddingObject:obj];

Append array to immutable array

NSArray *newArray = [array arrayByAddingObjectsFromArray:anotherArray];

Filter objects in the array using predicate

// people contains objects with NSString property "city"
NSPredicate *cityPredicate = [NSPredicate predicateWithFormat:@"city = 'Vancouver'"];
NSArray *vancouverites = [people filteredArrayUsingPredicate:cityPredicate];

Get subarray of the array

NSArray *top10 = [wholeArray subarrayWithRange:NSMakeRange(0, 10)];

Join strings in the array

NSArray *array = [NSArray arrayWithObjects:@"One", @"Two", @"Three", nil];
// Result is "One, Two, Three"
NSString *s = [array componentsJoinedByString:@", "];

Sort the array using comparator

NSArray *sortedArray = [array sortedArrayUsingComparator:^(id obj1, id obj2) {
    if ([obj1 relevance] > [obj2 relevance]) {
        return (NSComparisonResult)NSOrderedDescending;
    }

    if ([obj1 relevance] < [obj2 relevance]) {
        return (NSComparisonResult)NSOrderedAscending;
    }

    return (NSComparisonResult)NSOrderedSame;
}];

Sort the array using descriptors

NSArray *descriptors = [NSArray arrayWithObject:[NSSortDescriptor sortDescriptorWithKey:@"relevance" ascending:YES]];
// objects in array should be KVC-compliant
NSArray *sortedArray = [array sortedArrayUsingDescriptors:descriptors];

Sort the array using function

NSInteger relevanceSort(id result1, id result2, void *context)
{
    int r1 = [result1 relevance];
    int r2 = [result2 relevance];

    if (r1 < r2)
        return NSOrderedAscending;
    else if (r1 > r2)
        return NSOrderedDescending;
    else
        return NSOrderedSame;
}

NSArray *sortedArray = [array sortedArrayUsingFunction:relevanceSort context:NULL];

Sort the array using selector

NSArray *sortedArray = [array sortedArrayUsingSelector:@selector(caseInsensitiveCompare:)];

Write the array to file

[array writeToFile:@"/path/to/file" atomically:YES];

Write the array to URL

[array writeToURL:url atomically:YES];

Filter all paths with given extension

NSArray *txtFiles = [array pathsMatchingExtensions:@"txt"];

Get property list representation of the array

NSString *plist = [array description];

Create mutable copy of the array

NSMutableArray *ma = [array mutableCopy];