Download a PDF file from server
开发者_开发百科I want to download a PDF file from my server and save it to the documents directory. I am able to do this using NSData but then the file in the documents directory is not a PDF: it's an NSData object. Is there any way to download and save a straight PDF file?
NSData *pdfData = [NSData dataWithContentsOfURL:
[NSURL URLWithString:@"http://…"]];
[pdfData writeToFile:@"…" atomically:YES];
This does not work?
The tricky part is to save the file regularly, so that you don't keep all data in memory (we only have 64MB available on iOS)
加载中,请稍侯......
精彩评论