iOS Efficiency File Saving Efficiency

Posted by Guvvy Aba on Stack Overflow See other posts from Stack Overflow or by Guvvy Aba
Published on 2012-06-07T22:36:51Z Indexed on 2012/06/07 22:40 UTC
Read the original article Hit count: 436

Filed under:
|
|
|

I was working on my iOS app and my goal is to save a file that I am receiving from the internet bit by bit. My current setup is that I have a NSMutableData object and I add a bit of data to it as I receive my file. After the last "packet" is received, I write the NSData to a file and the process is complete. I'm kind of worried that this isn't the ideal way to do it because of the limitations of RAM in a mobile device and it would be problematic to receive large files.

My next thought was to implement a NSFileHandle so that as the file arrives, it would be saved to the disk, rather than the virtual memory.

In terms of speed and efficiency, which method do you think will work decently on an iOS device. I am currently using the first, NSMutableData approach. Is it worth changing my app to use the NSFileHandle?

Thanks in advance, Guvvy

© Stack Overflow or respective owner

Related posts about objective-c

Related posts about ios