Hello,
I'm trying to unparse a string into an array, here is my code:
EDIT: I've found a bit more information.
startTimeArray = [[NSMutableArray alloc] init];
NSString *tmpStartTimeString = [[tempItems objectAtIndex:0] valueForKey:@"temp_start_time"];
startTimeArray = (NSMutableArray *)[tmpStartTimeString componentsSeparatedByCharactersInSet:[NSCharacterSet characterSetWithCharactersInString:@"|"]];
[test3 setText:[NSString stringWithFormat:@"%i", [startTimeArray count]]];
The 'EXC_BAD_ACCESS' is deceiving, this is not where the problem is. The code above outputs the following details to the console:
UILable Test3 contains a 2 and the output from the array is as follows: Start Time: 2010-09-30 16:19:39 Start Time: 2010-09-30 16:19:43
At this point my array has values, so I then try to do the following:
startDateTime = [NSDate date];
NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
[formatter setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
NSString *strStartDateTime = [formatter stringFromDate:startDateTime];
[formatter release];
[startTimeArray addObject:strStartDateTime];
and this results in the following error:
-[__NSCFType addObject:]: unrecognized selector sent to instance 0x193370
I can see from Debugger, that strStartDateTime has a valid value.
Any thoughts ?
Regards, Stephen