我正在使用Dave DeLong的CHCSVParser解析CSV文件。我可以解析本地的CSV文件,但是我无法加载远程的CSV文件。今天我一直盯着我的MacBook看,答案就在我面前。这是我的代码:
NSString *urlStr = [[NSString alloc] initWithFormat:@"http://www.somewhere.com/LunchSpecials.csv"];
NSURL *lunchFileURL = [NSURL URLWithString:urlStr];
NSStringEncoding encoding = 0;
CHCSVParser *p = [[CHCSVParser alloc] initWithContentsOfCSVFile:[lunchFileURL path] usedEncoding:&encoding error:nil];
[p setParserDelegate:self];
[p parse];
[p release];
感谢任何能够提供帮助的人。