在iPhone上写入大文件的最快方法? [英] Fastest way to write a large file on the iPhone?

查看:69
本文介绍了在iPhone上写入大文件的最快方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用的该应用程序允许用户拍照,并将其保存在本地(通过Core Data的小缩略图图像,以及在文档目录中的完整尺寸的图像).我发现将图像文件写入文档目录需要花费很长时间-在我的iPhone 3GS上是8秒,在我的iPhone 3G和第一代iPod touch上甚至更长.我这样写文件:

This app i'm working on allows the user to take pictures, and saves them locally (a small thumbnail image via Core Data, and the full-size image in the documents directory). I'm finding that writing the image file to the documents directory takes a long time, though -- 8 seconds on my iPhone 3GS, even longer on my iPhone 3G and first-gen iPod touch. I write the file this way:

[imgData writeToFile:imagePathatomic:YES];

[imgData writeToFile:imagePath atomically:YES];

...是否有更快的方法可以做到这一点?iPhone的相机应用程序似乎可以非常快速地将图像写入文件系统.我可以在线程中进行编写,但是我担心用户可能在线程完成之前退出我的应用程序.

... is there a faster way to do this? The iPhone's camera app seems to write the images to the filesystem very quickly. I could do the writing in a thread, but i'm concerned about the user possibly quitting my app before the thread finishes.

推荐答案

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