0
我尝试使用下面的代码来读取我的iPhone项目的资源文件夹从1.txt的数据:iPhone文本文件阅读
NSString *fileContent = [NSString stringWithContentsOfFile:[[NSString stringWithFormat:@"%d", currentLevel] stringByAppendingString:@".txt"] encoding:NSUTF8StringEncoding error:nil];
NSAssert(fileContent!=nil, @"file's contents are nil");
currentLevel是最初被设置为1的整数一点也没有”无论我是否替换[[NSString stringWithFormat:@“%d”,currentLevel] stringByAppendingString:@“。txt”],用@“1.txt”(用于测试第一级),因为两次NSAssert都失败
为什么这不正常吗?我已经将1.txt导入到xcode中,并且它位于资源文件中。它不是空的。
这个没有工作。我第一次是对的。 谢谢! –