开发者

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)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜