2009-10-07 5 views
1

나는 로컬 파일의 URL을 전달하여 내 애플 리케이션에 ePub 파일을 다운로드하려면 :iPhone에 로컬로 epub 파일을 다운로드하는 방법은 무엇입니까?

http://www.jedisaber.com/eBooks/books/sample.epub

이 URL을 클릭하면 ePub 파일을 다운로드해야합니다. 내 앱에 다운로드하려면 어떻게해야합니까?

NSData를 사용해 보았지만 작동하지 않았습니다. 또한 파일을 내 문서 디렉토리로 복사하려고 시도했지만 작동하지 않았습니다. 아무도 내가 Objective-C에서 어떻게이 일을 할 수 있는지 말해 줄 수 있습니까?

도움 말을 주시면 감사하겠습니다.

도움 주셔서 감사합니다.

+0

안녕, 당신보다 problem.If 예 위의에 대한 해결책을 찾기 바랍니다 다음 링크에 나와 써주세요. 감사합니다. Advance. http://stackoverflow.com/questions/16416640/how-to-download-epub-format-file-from-url-to-document-directory-in-iphone –

답변

2

EPUB는 ZIP 형식이므로 이진 스트림 다운로드 방법을 사용하여 파일을 iPhone에 이진 파일로 저장하면됩니다. EPUB 언급 ARCON AS

0

은 ZIP 형식입니다, 당신은 UR 컴퓨터에 문서 디렉토리에 저장 & 파일 압축 해제 파일 의 압축을 해제 할 수 있습니다 ZipArchive *의 ZA = [[ZipArchive ALLOC] 초기화]를; 경우 ([ZA UnzipOpenFile : [[NSBundle mainBundle] pathForResource : @ "도움말"ofType "EPUB"] @]) {

NSString *strPath = [NSString stringWithFormat:@"%@/UnzippedEpub",[self applicationDocumentsDirectory]]; 

    //Delete all the previous files 
    NSFileManager *filemanager = [[NSFileManager alloc] init]; 
    if ([filemanager fileExistsAtPath:strPath]) { 
     NSError *error; 
     [filemanager removeItemAtPath:strPath error:&error]; 
    } 
    [filemanager release]; 
    filemanager = nil; 

    //start unzip 
    [za UnzipFileTo:strPath overWrite:YES]; 
    NSLog(@"path : %@",strPath); 
}     
[za release]; 
관련 문제