On iOS, our application is downloading a zip file that's approximately 400MB. We're getting intermittent crashing while the file is downloading.
Current I'm using [NSFileHandle writeData:] to write the data as it comes in, and is not being stored in memory. But I'm wondering if the operating system is somehow storing it in memory?
Would NSOutputStream be a better solution to downloading large file? Or possibly standard unix file descriptors?
Our file handle is setup like this:
NSFileManager * fileManager = [NSFileManager defaultManager];
[fileManager createFileAtPath:tmpFilePath.path contents:nil attributes:nil];
_zipFile = [NSFileHandle fileHandleForWritingAtPath:tmpFilePath.path];
Currently my NSURLConnection delegate method looks like this:
- (void) connection:(NSURLConnection *) connection didReceiveData:(NSData *) data {
[_zipFile writeData:data];
}
So the data that comes in from the request is not stored or appended to any other data objects. Shouldn't this just write to disk and not effect memory?
Thanks