Intermittent Image Capture


#1

After entering the code in “Taking Pictures with UIImagePickerController” I’ve found that when I repeatedly take pictures on my iPhone 3G that the picture is only intermittently displayed in the UIImage. For example, I take the first picture and the image is displayed, I immediately re-take the picture (without doing anything else) the sometimes UIImage is blank, I re-take the picture a third time and usually UIImage displays the new picture. Displaying a picture in UIImage is even more inconsistent when I have the iPhone connected to my MacBook Pro in debug mode. It seems like sometimes the image data makes it to UIImage and sometimes it doesn’t. Is it some sort of a timing issue? What can be done so that the image is consistently displayed after it is taken? Thanks!

=======

Followup - The problem does appear to be some sort of a timing issue because when I add the additional code found in “Creating and Using Keys” the image appears to be displayed each time. Is there a way to prevent the problem from occurring if you don’t add the additional code?


#2

What is actually happening is, your iPhone is receiving a low memory warning that is immediately destroying the UIImageView that will house the image you just took. Unfortunately, the additional code is necessary.


#3

Thanks very much for the information regarding the cause of the disappearing image – those seemingly random problems always drive me crazy :slight_smile: