NSData的附加在目标C的文件 [英] Append NSData to a file in Objective C

查看:134
本文介绍了NSData的附加在目标C的文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图下载iPhone上的一个大文件并将其保存到磁盘,因为它被下载。

I'm attempting to download a large file on the iPhone and save it to disk as it is downloaded.

在理想情况下,在

-(void)connection:(NSURLConnection*)connection didReceiveData:(NSData*)data {

}

我想数据附加到磁盘上的文件。

I want to append 'data' to a file on disk.

我已经签出NSData的文档。有功能写入一个文件,但我看不到任何东西附加到现有文件。

I've checked out the NSData documentation. There are functions to write to a file, but I can't see anything to append to an existing file.

有谁知道我可以追加这个数据?任何帮助非常AP preciated!
尼克。

Does anyone know how I can append this data? Any help much appreciated! Nick.

推荐答案

您可以使用 -writeData的组合: -seekToEndOfFile NSFileHandle 类方法编写的NSData 到文件的末尾。

You can use a combination of -writeData: and -seekToEndOfFile methods from NSFileHandle class for writing NSData to the end of a file.

这篇关于NSData的附加在目标C的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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