I was curious about how low memory warnings impact this example. I had a bunch of apps running on my iPhone 4 (including some video editing, photo apps, and others) and ran the code to test the Image Picker for the first time. One thing I noticed is that the camera would allow me to take and use a photo; however when control returned back to my Item Detail View it did not display the chosen image.
I looked in the debug console and saw the following:
2010-11-21 12:49:41.330 Homepwner[2291:307] Using two-stage rotation animation. To use the smoother single-stage animation, this application must remove two-stage method implementations.
2010-11-21 12:49:41.333 Homepwner[2291:307] Using two-stage rotation animation is not supported when rotating more than one view controller or view controllers not the window delegate
2010-11-21 12:49:42.219 Homepwner[2291:307] Received memory warning. Level=1
2010-11-21 12:49:43.080 Homepwner[2291:307] Received memory warning. Level=2
2010-11-21 12:49:47.394 Homepwner[2291:307] Received memory warning. Level=1
When I manually forced my other apps to close - and re-ran the code - it performed exactly as expected (displaying the selected photo for all of the possessions in the list).
Taking a look at the didReceiveMemoryWarning: code, I began to wonder:
[code]- (void)didReceiveMemoryWarning {
// Releases the view if it doesn’t have a superview.
[super didReceiveMemoryWarning];
// Release any cached data, images, etc that aren't in use.
}
[/code]
If I am understanding this right, the image was released as a sort of damage control, right? If this were in a production app, am I correct in thinking that here is where I would pop open an alert to the user to let them know the image was not saved - and that they should close any unnecessary apps on their iOS device to prevent against unexpected behavior?