Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Received memory warning. Level=1 when showing a UIImagePickerController

Tags:

This is driving me crazy!!!

I'm getting a "Received memory warning. Level=1" whenever I attempt to show a UIImagePickerController with a sourceType = UIImagePickerControllerSourceTypeCamera.

Here is the code from my viewDidLoad where I set things up:

    - (void)viewDidLoad {      [super viewDidLoad];      // Set card table green felt background     self.view.backgroundColor = [UIColor colorWithPatternImage: [UIImage imageNamed:@"green_felt_bg.jpg"]];       // Init UIImagePickerController     // Instantiate a UIImagePickerController for use throughout app and set delegate     self.playerImagePicker = [[UIImagePickerController alloc] init];     self.playerImagePicker.delegate = self;     self.playerImagePicker.sourceType = UIImagePickerControllerSourceTypeCamera; } 

And here is how I present it modally ..

- (IBAction) addPlayers: (id)sender{ [self presentModalViewController:self.playerImagePicker animated:YES]; 

}

The result ... UIImagePicker starts to show and then boom ... I get the memory warning ... EVERY TIME! Interestingly enough, if I switch to sourceType = UIImagePickerControllerSourceTypePhotoLibrary ... everything works fine.

What in the heck am I missing or doing wrong? All I want to do is show the camera, take and save a picture.

FYI - I'm testing on my 3GS device.

Thanks to anyone who can help :)

like image 947
wgpubs Avatar asked Jun 23 '10 05:06

wgpubs


1 Answers

This is very common. As long as you handle the memory warning without crashing and have enough space to keep going, don't let it drive you crazy.

like image 93
progrmr Avatar answered Sep 22 '22 20:09

progrmr