I'm trying to build an array of arrays with data from a plist. I've built a normal working array of arrays:
I can call that and it returns correctly. But when I do it with the plist arrays, it just doesn't work right. I can make one array display correctly, but when I try to put that into another array, the build succeeds, but the app instantly crashes.
In the following example, when I return only one of the tableDataSource(s) it works, but load them into an array, and it fails.
Can someone tell me where I've gone wrong? Debugger says "-[__NSCFDictionary caseInsensitiveCompare:]: unrecognized selector sent to instance 0x5f4a7b0".
Code:
listOfItems = [[NSMutableArray alloc] init];
NSArray *countriesE = [NSArray arrayWithObjects:@"England", nil];
NSArray *sortedArrayE = [countriesE sortedArrayUsingSelector:@selector(caseInsensitiveCompare:)];
NSDictionary *countriesSE = [NSDictionary dictionaryWithObject:sortedArrayE forKey:@"Countries"];
NSArray *countriesF = [NSArray arrayWithObjects:@"Finland", @"France", nil];
NSArray *sortedArrayF = [countriesF sortedArrayUsingSelector:@selector(caseInsensitiveCompare:)];
NSDictionary *countriesSF = [NSDictionary dictionaryWithObject:sortedArrayF forKey:@"Countries"];
[listOfItems addObject:countriesSE];
[listOfItems addObject:countriesSF];
I can call that and it returns correctly. But when I do it with the plist arrays, it just doesn't work right. I can make one array display correctly, but when I try to put that into another array, the build succeeds, but the app instantly crashes.
In the following example, when I return only one of the tableDataSource(s) it works, but load them into an array, and it fails.
Code:
everythingArray = [[NSMutableArray alloc] init];
NSArray *tempArrayC = [[NSArray alloc] init];
self.tableDataSourceC = tempArrayC;
NSArray *sortedArrayC = [tempArrayC sortedArrayUsingSelector:@selector(caseInsensitiveCompare:)];
[sortedArrayC release];
DrillDownAppAppDelegate *AppDelegateC = (DrillDownAppAppDelegate *)[[UIApplication sharedApplication] delegate];
self.tableDataSourceC = [AppDelegateC.data objectForKey:@"C"];
//Initialize our table data source
NSArray *tempArrayJ = [[NSArray alloc] init];
self.tableDataSourceJ = tempArrayJ;
NSArray *sortedArrayJ = [tempArrayJ sortedArrayUsingSelector:@selector(caseInsensitiveCompare:)];
[sortedArrayJ release];
DrillDownAppAppDelegate *AppDelegateJ = (DrillDownAppAppDelegate *)[[UIApplication sharedApplication] delegate];
self.tableDataSourceJ = [AppDelegateJ.data objectForKey:@"J"];
[everythingArray addObject:countriesSC];
//[everythingArray addObject:tableDataSourceJ];
Can someone tell me where I've gone wrong? Debugger says "-[__NSCFDictionary caseInsensitiveCompare:]: unrecognized selector sent to instance 0x5f4a7b0".