我正在尝试读取 CSV 文件。我已经在我的应用程序中导入了文件,所以文件在本地。当我在下面执行这部分代码时:
@autoreleasepool {
NSError *error;
NSString *alldata = [NSString stringWithContentsOfFile:@"config_menu_position.csv"
encoding:NSUTF16StringEncoding error:&error];
NSLog(@"alldata: %@", alldata);
NSLog( @"error: %@", error );
}
我有这个日志错误消息,我的变量总是 nul:
2013-04-21 17:05:37.571 PageViewController[1578:c07] alldata :(null)
2013-04-21 17:05:38.242 PageViewController[1578:c07] error: Error Domain=NSCocoaErrorDomain
Code=260 "The operation couldn’t be completed. (Cocoa error 260.)" UserInfo=0x7ebf100
{NSFilePath=config_menu_position.csv, NSUnderlyingError=0x7ebf060 "The operation couldn’t be
completed. No such file or directory"}
任何想法?