2012-09-11 4 views
-4

어떻게 파일을 서버에서 다운로드 할 수 있습니까?웹 서비스에서 iPhone으로의 PDF

웹 서비스에서 PDF 파일을 iPhone으로 보낼 수있는 방법이 있습니까?

pdf를 다른 형식으로 변환 한 다음 다시 보내야합니까?

답변

1

당신은 쉽게 URL을 어떤 형식으로 변환 할 필요가 서버에 두 번째 질문 저장소에 대한 코드

NSData *pdfData = [[NSData alloc] initWithContentsOfURL:[NSURL URLWithString:downloadUrl]]; 

    //Store the Data locally as PDF File 

NSString *resourceDocPath = [[NSString alloc] initWithString:[[[[NSBundle mainBundle] resourcePath] stringByDeletingLastPathComponent] stringByAppendingPathComponent:@"Documents"]]; 
NSString *pdf1; 
pdf1 = [NSString stringWithFormat:@"%@.pdf",yourBookTitle]; 

NSString *filePath = [resourceDocPath stringByAppendingPathComponent:pdf1]; 

[pdfData writeToFile:filePath atomically:YES]; 

이하로 사용하여 PDF 파일을 당신의 PDF 파일을 다운로드하지 않고 얻을 수 있습니다