gpt4 book ai didi

ios - CHCSV 解析器错误 : No known class method for selector 'arrayWithContentsOfCSVFile:encoding:error:'

转载 作者:行者123 更新时间:2023-11-28 22:28:16 25 4
gpt4 key购买 nike

当尝试像这样使用 CHCSV 解析器时:

#import "CHCSVParser.h"
....

- (IBAction)hi:(id)sender {
NSString *path = [[NSBundle mainBundle] pathForResource:@"nood" ofType:@"csv"];

NSError *error = nil;
NSArray *rows = [NSArray arrayWithContentsOfCSVFile:path encoding:NSUTF8StringEncoding error:&error];
if (rows == nil) {
//something went wrong; log the error and exit
NSLog(@"error parsing file: %@", error);
return;
}

}

我得到错误:

No known class method for selector arrayWithContentsOfCSVFile:encoding:error:

我已经包含了 CHCSV header ,但此错误仍然发生。这个问题与this完全一样一个,但从未得到答复,因此请不要将其标记为重复。

最佳答案

The header from github貌似没有这种方法。您的选择似乎是:

+ (instancetype)arrayWithContentsOfCSVFile:(NSString *)csvFilePath;
+ (instancetype)arrayWithContentsOfCSVFile:(NSString *)csvFilePath options:(CHCSVParserOptions)options;

请注意,两者都没有 encoding: 参数。

关于ios - CHCSV 解析器错误 : No known class method for selector 'arrayWithContentsOfCSVFile:encoding:error:' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18293085/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com