-3
我在支持文件中保存了一个文件。现在我想将该文件中的文本复制到xcode中的文本字段中。请帮助我解决这个问题。如果可能,请发布任何代码。 我已经使用了下面的代码,但我无法访问。如何从xcode项目中的本地文本文件中获取文本
NSString *filePath = [[NSBundle mainBundle] pathForResource:@"iPhone.txt" ofType:@"txt"];
NSString *textData = [NSString stringWithContentsOfFile:filePath encoding:NSUTF8StringEncoding error:nil];
NSLog(@"Some text from a file of %@", textData);
NSLog(@"The length of the string is %u",[textData length]);
错误:
* Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '-[UIViewController _loadViewFromNibNamed:bundle:] loaded the "FirstInMacViewController" nib but the view outlet was not set.' * First throw call stack: