2012-08-23 5 views
-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:

답변

1

그 오류가 당신이 게시 된 코드와는 아무 상관이있다. 당신의 펜촉에 콘센트 view을 잘못 연결 한 것 같습니다. 펜촉을 열고 마우스 오른쪽 버튼으로 파일 소유자에서 최상위보기로 드래그하고 view 콘센트를 연결하십시오.

관련 문제