Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

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 :)

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
339 views
Welcome To Ask or Share your Answers For Others

1 Answer

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share

548k questions

547k answers

4 comments

86.3k users

...