I am writing an application that uses UIImagePickerController to take multiple pictures with the camera as fast as iOS allows. My application has to run on iOS 3.13 on all versions of iPhone hardware (v1 through 4). I am using UIImagePickerController with a cameraOverlayView.
My question is, how can I determine programmatically how many photos can be processed at once based on available memory? See below for more details. Any help is appreciated!
When the imagePicker delegate recieves imagePicker:didFinishPickingMediaWithInfo:, the delegate saves the full size image in the savedPhotosAlbum with UIImageWriteToSavedPhotosAlbum(). Once I have this problem solved, the app will be doing more things with the full size image.
As a test, I take pictures as fast as I can. Eventually, as expected, the app receives memory warning due to the large number of photos in memory while saving to the photo album. If I ignore the memory warnings and continue taking pictures, eventually the app is killed by iOS b/c of this.
I have no problem with setting a limit on the number of concurrent photos I allow the app to process at a time. Each iPhone HW version has different memory capacities and different camera resolutions. With iOS 4, multi-tasking may also effect the available memory. I'd rather do this programmatically than hard-code a limit based on HW version.
A test application that shows this behavior is at Source Code