Im trying to split an array of objects into smaller arrays containing 32 objects. With the remaining about being put into the array at the end.
This is the code I\'m usi
2nd parameter of NSMakeRange is length range to create, not the last index in it. So you need to change your code accordingly (simplifying it a bit):
NSUInteger count = sharedManager.inventoryArray2.count;
NSMutableArray *arrayOfArrays = [NSMutableArray array];
NSUInteger from = 0;
while (from < count) {
NSRange range = NSMakeRange(from, MIN(32, count-from));
NSArray *smallArray = [sharedManager.inventoryArray2 subarrayWithRange:range];
[arrayOfArrays addObject:smallArray];
from += 32;
}