I’ve done the following to put a fetched request into an array of arrays but now i don’t know which methods i need to call from chcsvparser to write this into a csv file
NSArray *objectsForExport = [fetchedResultsController fetchedObjects];
NSArray *exportKeys = [NSArray arrayWithObjects:@"best_checkout", @"darts_thrown", @"high_score", @"score_100", @"score_140", @"score_180",@"three_dart_average",nil];
NSMutableArray *csvObjects = [NSMutableArray arrayWithCapacity:[objectsForExport count]];
for (NSManagedObject *object in objectsForExport) {
NSMutableArray *anObjectArray = [NSMutableArray arrayWithCapacity:[exportKeys count]];
for (NSString *key in exportKeys) {
id value = [object valueForKey:key];
if (!value) {
value = @"";
}
[anObjectArray addObject:[value description]];
}
[csvObjects addObject:anObjectArray];
}
This webpage should give you the necessary information and methods when writing CSV files:
https://github.com/davedelong/CHCSVParser#readme
Hope this helps!