I am trying to create a search box to go with my UITableView, I am currently loading a JSON request into NSDictionaries and then using that to populate my table (all working fine)
I am using a second array of data to perform the search on from the search ba, but find that I cannot copy my original array.
This is my code, and the debug output:
NSDictionary * root = [responseString JSONValue];
//NSLog(root);
sortedArryData = [root objectForKey:@"add"];
NSLog(@"%@",sortedArryData);
[arryData arrayByAddingObjectsFromArray:sortedArryData];
NSLog(@"New: ");
NSLog(@"%@",arryData);
Output:
2011-12-12 21:24:39.264 app[18766:11603] Run
2011-12-12 21:24:40.677 app[18766:11603] (
{
address = "15 Southampton Road";
},
{
address = "Meeting House Lane";
}
)
2011-12-12 21:24:40.709 app[18766:11603] New:
2011-12-12 21:24:40.709 app[18766:11603] (null)
Is there something i’m missing? both arryData and sortedArryData as NSMutableArray
Thanks
Mark
You probably have not initialized arryData, right before adding to the array go ahead and initialize it like so:
EDIT:
Try this instead: