지원 파일에 파일을 보관했습니다. 이제 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: