1

I'm using CHCSVParser to parse a CSV on an iPhone. If I don't wraps the fields in the CSV it works fine. Except that I then can't use commas in the fields! But if I use quotes it doesn't import anything. Example CSV that fails:

"Myotis", "distribution-myotis.png", "myotis description"
"Bbar", "bbar-distribution.png", "bbar description"
"Lesser Horseshoe", "distribution-lesser-horsehoe.jpg", "LH description"

Code:

NSString *CSVfile = [[NSBundle mainBundle] bundlePath];
CSVfile = [CSVfile stringByAppendingString:@"/batDB.csv"];
_batDB = [NSArray arrayWithContentsOfCSVFile:CSVfile options:CHCSVParserOptionsSanitizesFields];
NSLog(@"%@", _batDB);

This logs null. Without the quotes it correctly logs the contents on the CSV file in the array.

Any ideas?!

4

1 に答える 1