用asihttprequest下载/检索pdf [英] Download / retrieve pdf with asihttprequest

查看:209
本文介绍了用asihttprequest下载/检索pdf的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用此功能将iPad内容中的内容下载到本地文件系统(cachedDir?)
中:

I'm trying to download content with an URL to a local file system in my iPad (cachedDir ? ) with this function:

- (IBAction)download:(id)sender {

NSURL *url = [NSURL URLWithString:@"http:www.google.de"];

ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:url];
[request setDelegate:self];
[request startAsynchronous];
[request setDownloadDestinationPath:@"/Users/ben/Desktop/my_file.pdf"]; // Which //directory??

}

如果我的路径我必须选择哪个目录想要尽可能长时间地存储数据,而不会被Apple拒绝,
,如何检索我保存的数据?

Which directory do I have to choose for my path if I want to store the data as long as possible without getting rejected by Apple, and how do I retrieve the data I've saved?

有人可以帮忙吗?

推荐答案

存储文件的最佳位置是您的应用程序的文档。您可以这样找到路径:

The best place to store documents that you want to keep around is your application's Documents directly. You can find the path to it like so:

// Returns the URL to the application's Documents directory.
- (NSURL *)applicationDocumentsDirectory
{
    return [[[NSFileManager defaultManager] URLsForDirectory:NSDocumentDirectory inDomains:NSUserDomainMask] lastObject];
}

苹果有一个关于iOS文件系统的文档,特定类型的文件: http://开发人员.apple.com / library / mac /#documentation / FileManagement / Conceptual / FileSystemProgrammingGUide / FileSystemOverview / FileSystemOverview.html

Apple have a useful piece of documentation about the iOS file system and where to store particular types of files: http://developer.apple.com/library/mac/#documentation/FileManagement/Conceptual/FileSystemProgrammingGUide/FileSystemOverview/FileSystemOverview.html

这篇关于用asihttprequest下载/检索pdf的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆