Of course
I have a basic if statement to see if the current location has been found, if it has it uses the same code as below with a bit more padding to calculate a distance, if current location has not been found the arrary of locations is updated with a new key called
distance with a value of
Location Not Found.
Basically it reads the object from the current array index into a dictionary (not required here as we allready know the location has not been found), uses the location information about the object that it pulled from the array (once again not shown here), creates a new string -
distancestring, adds a new key to the array (distance) and adds the
distancestring as the value to the new key.
Code:
for (i = 0; i < count; i++) {
//NSDictionary *itemAtIndex = (NSDictionary *)[tempArray objectAtIndex:i];
NSString *distanceString;
distanceString = @"Location Not Found";
NSArray *newObjectKeys = [itemAtIndex allKeys];
newObjectKeys = [newObjectKeys arrayByAddingObject:@"distance"];
NSArray *newObjectArray = [itemAtIndex allValues];
newObjectArray = [newObjectArray arrayByAddingObject:distanceString];
NSDictionary *newObjectDictionary = [NSDictionary dictionaryWithObjects:newObjectArray forKeys:newObjectKeys];
[tempArray replaceObjectAtIndex:i withObject:newObjectDictionary];
}