Can someone explain with this error message please?
Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[NSCFArray objectAtIndex:]: index (2) beyond bounds (1)'
It seems to be caused by this piece of code:
Does anyone know what the problem is?
Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[NSCFArray objectAtIndex:]: index (2) beyond bounds (1)'
It seems to be caused by this piece of code:
Code:
NSMutableArray *wholeArray = [[NSMutableArray alloc] init];
NSEnumerator *enumerator = [linesArray objectEnumerator];// linesArray is an array containing several long strings
id currentObject;
while (currentObject = [enumerator nextObject]) {
NSArray *array = [currentObject componentsSeparatedByString:@","];
Entry *line = [[Entry alloc] initWithdate:[array objectAtIndex:0] time:[array objectAtIndex:1] value:[array objectAtIndex:2]]; /*Entry is just a custom class which takes in three strings when initialized.*/
[wholeArray addObject:line];
}
Does anyone know what the problem is?