2011-07-29 2 views

답변

1

은 당신이 제대로 pathForResource 구현하지 않은 :

NSString * string = [[NSBundle mainBundle] pathForResource"@"list-50.xml" ofType:@"xml"]; 

이것은 잘못된 것입니다.

그래서

NSString * string = [[NSBundle mainBundle] pathForResource:@"list-50" ofType:@"xml"]; 
2

사용 [[NSBundle mainBundle] pathForResource:@"myfile" ofType:@"xml"] 경로를 얻을 수 있습니다. 거기에서 NSData, NSString 또는 다른 클래스를 사용하여 데이터를로드 할 수 있습니다.

+0

되어야 I 한 본 :있는 NSString * 문자열 = [NSBundle mainBundle] pathForResource "@"리스트 50.xml "ofType @"XML "] 다음을 NSData * 데이터 = [[NSData alloc] initWithContentOfFile : path];하지만 프로젝트에 파일을 저장하고 대상 폴더에 파일을 복사하지 않습니다. – Ashutosh

+0

'@ "list-50.xml"'을 사용하지 말고 그냥' @ "list-50"'.xml은'ofType :'부분에서옵니다. – jtbandes

관련 문제