2014-02-19 3 views
0

저는 iPad 응용 프로그램에서 작업 중이며 ZipArchive를 사용하여 다운로드 한 파일의 압축을 풉니 다. 그러나 파일을 열려고하면 open 메서드가 nil 매개 변수를 전달했다고 생각합니다.iOS : 문자열 매개 변수를 함수에 전달했지만 다른 끝에 NULL이 있습니까?

NSString* filepath = [[[NSBundle mainBundle] pathForResource:@"help_me.zip" ofType:@"zip"] copy]; 
ZipArchive* zipArchive = [[ZipArchive alloc] init]; 
[zipArchive UnzipOpenFile:filepath Password:@"XYZ"]; 

'UnzipOpenFile'메서드에서 'filePath'가 nil이라고 디버거가 말합니다. 왜 이런 일이 일어날 지 모르겠습니다. 어떤 아이디어?

답변

2

[[NSBundle mainBundle] pathForResource:@"help_me.zip" ofType:@"zip"] 

에서 당신은 반환 할 수 있도록, 두 번 파일 확장자 을 지정 nil (파일이 "help_me.zip.zip"라고하지 않는 한). 한 그것은 Btw는

[[NSBundle mainBundle] pathForResource:@"help_me" ofType:@"zip"] 

해야합니다., copy 파일 경로에 대한 필요가 없습니다.

+0

이것은 올바른 답변입니다. 고맙습니다. 나는 Stack의 규칙에 따라 9 분 안에 대답을 수락 할 것이다. – easythrees