I have a small utility application that parses a csv file and uses the data to populate the Core Data storage for use with another application. I open a csv file with -initWithContentsOfFile:encoding:error: and the method always returns nil with an error
Error Domain=NSCocoaErrorDomain Code=260 UserInfo=0x100106450 "The file "data.csv" couldn't be opened because there is no such file." Underlying Error=(Error Domain=NSPOSIXErrorDomain Code=2 "The operation couldn't be completed. No such file or directory"), { NSFilePath = "/Users/****/Library/Developer/Xcode/DerivedData/CreateData- bhkmspyczgcfcrgehcbaydwdbfoa/Build/Products/Debug/data.csv"; NSUnderlyingError = "Error Domain=NSPOSIXErrorDomain Code=2 \"The operation couldn\U2019t be completed. No such file or directory\""; }
Now I am browsing this exact file in this exact directory. Even more confusing is the fact that I have a different version of essentially the same utility for another application that works - the only difference is the creation of the main data and entity store and the number of columns in the csv file, all of which are called after the csv file is loaded . Or failed to load, as it were ...
int main (int argc, const char * argv[]) { NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; NSError *error = nil; NSString *csvFile = [[NSString alloc] initWithContentsOfFile:csvFilePath(QUESTIONS_INPUT_FILENAME) encoding:NSASCIIStringEncoding error:&error];
royen source share