下载
来源:互联网 发布:金融行业使用软件 编辑:程序博客网 时间:2024/04/30 07:44
2. /Documents/。使用该路径放置关键数据,也就是不能通过App重新生成的数据。该路径可通过配置实现iTunes共享文件。可被iTunes备份。(现在保存在该路径下的文件还需要考虑iCloud同步)3. /Library/。该路径下一般保存着用户配置文件。可创建子文件夹。可以用来放置您希望被备份但不希望被用户看到的数据。该路径下的文件夹,除Caches以外,都会被iTunes备份。4. /tmp/。使用该路径保存临时文件。App应该删除那些不再被使用的文件,系统也会在App关闭后删除残留文件。该路径下的文件不会被iTunes备份。NSArray* paths = NSSearchPathForDirectoriesInDomains(NSPicturesDirectory, NSUserDomainMask, YES); NSString* _filePath = [paths objectAtIndex:0]; NSString *fileName = [NSString stringWithFormat:@"filename.pdf",]; NSString *filePath = [_filePath stringByAppendingPathComponent:fileName];NSString *urlStr =@"http://loadurlStr"; NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:urlStr]]; AFURLConnectionOperation *operation = [[AFURLConnectionOperation alloc]initWithRequest:request]; operation.outputStream = [NSOutputStream outputStreamToFileAtPath:filePath append:YES]; [operation setDownloadProgressBlock:^(NSUInteger bytesRead, long long totalBytesRead, long long totalBytesExpectedToRead) { NSLog(@"%f",totalBytesRead/(float)totalBytesExpectedToRead); }]; [operation setCompletionBlock:^{ //用webview打开下载下来的文件 NSURL *url = [NSURL fileURLWithPath:filePath]; NSURLRequest *request = [[NSURLRequest alloc]initWithURL:url cachePolicy:NSURLRequestUseProtocolCachePolicy timeoutInterval:20]; UIWebView *web = [[UIWebView alloc]initWithFrame:self.view.bounds]; [self.view addSubview:web]; [self.view bringSubviewToFront:web]; [web loadRequest:request]; }]; [operation start];
0 0
- 下载
- 下载
- 下载
- 下载
- 下载???
- 下载
- 下载
- 下载
- 下载
- 下载
- 下载
- 下载
- 下载
- 下载
- 下载
- 下载
- 下载
- 下载
- Objective-C中,遍历数组的四种方法
- linux实战(十一)----shell监控服务器性能---综合运用
- 运行时runtime
- C#中的委托和事件
- iOS 移除所有子视图
- 下载
- 反汇编一个简单的C程序,分析汇编代码理解计算机是如何工作的
- android中xml tools属性详解
- HTTP协议(二):header标头说明
- 仅当使用了列的列表,并且IDENTITY_INSERT为ON时,才能在表'goldlog'中为标识列指定显式值
- CodeForces 624 B. Making a String(贪心)
- centos minimal 网络配置详细解读
- 第一行代码-9.2 Android 多线程编程
- openGL画点---openGL学习笔记(二)