我有一个文本文件thetext.txt
。这是在我的项目中,并在构建时复制,在构建设置中。就像我的 GL 着色器和纹理一样(工作正常。)
NSError *errorReading;
NSArray *linesOfText = [[NSString stringWithContentsOfFile:@"thetext.txt"
encoding:NSUTF8StringEncoding
error:&errorReading]
componentsSeparatedByString:@"\n"];
NSLog(@"Reading error %@",errorReading);
它将以下内容打印到控制台。
Reading error Error Domain=NSCocoaErrorDomain Code=260 "The operation couldn’t be completed. (Cocoa error 260.)" UserInfo=0x896fff0 {NSFilePath=thetext.txt, NSUnderlyingError=0x896ff60 "The operation couldn’t be completed. No such file or directory"}
我错过了什么吗?