The iOS app I’m working on handles very large files (largest being 2.7 gig in size), and some sqlite tables, after downloading the large I’m getting console messages like this one :
Aug 24 14:50:28 unknown TheAppName[1407] <Warning>: Error opening database: 14 unable to open database file
Also other issues that happen, loading a view (which has already been loaded and presented) will cause a crash saying “nib cannot be located”.
The app can run without the large file just fine, but it is very useful to have. The question I have is this : Is the large file causing some sort of memory issue, or is there some sort of limit that iOS places on files? I’ve looked around at other places and I’ve been unable to find anything specific to this.
Does it work in the Simulator or do you also have the same issue there?
I suggest you run your app using Instruments with the ObjectAlloc tool. Its likely you have some leaks in the way you are managing the download. Or, is there free space on the device for this file?
Others have had success with downloading huge files as long as sufficient space exists on the flash. You can test for this – there are a few functions floating around that tell you how to determine free disk space.
Another idea: write your file to the disk with the “F_NOCACHE” (fcntl) flag set on the file descriptor. This will cause the writes to bypass the “uniform buffer queue”, which is used to cache disk blocks and for other memory uses, and will greatly reduce stress on the system itself.