views:

74

answers:

1

Mysterious (at least to me) issue. Here's what I'm doing

- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
    UIImage *neoImage = [[info objectForKey:UIImagePickerControllerEditedImage] retain];
    NSLog(@"neoImage: %@", neoImage);
    [self.images addObject:neoImage];
    [neoImage release];
    NSLog(@"self.images (inside delegate method): %@", self.images);
    [self renderImages];
    [picker dismissModalViewControllerAnimated:TRUE];
}

self.images declared as retained mutable array and synthesized. I must be doing something wrong though, because while the above code works as expected when the user selects an image from their camera roll, this is the NSLog output when they take a new picture:

[2690:307] neoImage: <UIImage: 0x24f160>
[2690:307] self.images (inside delegate method): (null)

I'm probably overlooking something obvious? Any help will be appreciated.

NOTE: I'm also receiving a memory warning when the camera is used:

Received memory warning. Level=1
A: 

... yeah, I'm a moron. It was the memory issue. I was releasing self.ideas on viewDidUnload and I guess the view gets released on receipt of the memory warning because at the time the memory warning is received the image picker modal view is active, not its parent. The memory warning was only being raised when the camera was launched, not the camera roll picker, thus the different behavior depending on which was selected.

codemonkey