I’m developing a GIS-based application and I have organized data fro the user to search in different categories. I have arranged them in a plain UITableView.Now, every category has a correspondent ID string (f.e.: category Hospitals has an ID : f556682-de5tgh4dde-ff478).I have made two arrays: One that holds the categories and one that holds the ID strings.I think the association of the ID string to each category must be done via a NSMutableDictionary, but not sure how to do it and how to make a string that is created dynamically each time the user selects a determinate number of rows and is the result of the concatenation of the ID strings of the selected cells? I need this string to be passed to a server that depending of the string creates on the fly KML files.(The reason I need it.)This is the code I have done until now:
NSDictionary *dictionary = [gisCategoryID objectAtIndex:indexPath.row];//gisCategoryID is an array that holds the ID strings
NSLog(@"ID %@", [dictionary objectForKey: @"ID");
NSLog(@"Name %@", [dictionary objectForKey: @"Name");
NSMutableString *categString = [[[NSMutableString alloc] init] autorelease];
for (NSMutableDictionary *categInfo in dictionary)
[categString appendFormat: @"%@&", [categInfo objectForKey:@"ID"]];
I have doubts for this being the correct way because every time I select a row, the app crashes.
1 Answer