使用CHCSV解析器时出错:对于选择器'arrayWithContentsOfCSVFile:没有已知的类方法:encoding:error:' [英] Error using CHCSV Parser: No known class method for selector 'arrayWithContentsOfCSVFile:encoding:error:'

查看:153
本文介绍了使用CHCSV解析器时出错:对于选择器'arrayWithContentsOfCSVFile:没有已知的类方法:encoding:error:'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用CHCSV Parser使用csv创建数组。但是,我收到此错误:

I'm using CHCSV Parser to create an array using a csv. However, I' getting this error:


没有已知的选择器类的方法arrayWithContentsOfCSVFile:encoding:error:'

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

这是我创建数组的方式:

This is how I create my array:

NSString *path = [[NSBundle mainBundle] pathForResource:@"Data" 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;


}

感谢您的帮助C: p>

Thanks for the help C:

推荐答案

来自github的标题似乎没有这样的方法。您的选择似乎是:

The header from github appears to have no such method. Your choices appear to be:

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

请注意,两者都没有编码:

Note that neither has an encoding: argument.

这篇关于使用CHCSV解析器时出错:对于选择器'arrayWithContentsOfCSVFile:没有已知的类方法:encoding:error:'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆