Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5844163
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T12:15:14+00:00 2026-05-22T12:15:14+00:00

Hi I receive memory warning whenever I am using camera. The error is like

  • 0

Hi I receive memory warning whenever I am using camera.

The error is like this:

"Receive memory warning..."

And the code is:

-(void) getPhoto{

    GameAppdelegate *appDelegate = (GameAppdelegate *)[[UIApplication sharedApplication]delegate];

    UIImagePickerController * picker = [[UIImagePickerController alloc] init];
    picker.delegate = self;
    picker.allowsEditing = YES;

    ///////////////////////////////////photolibrary//////////////////////////////
    if([appDelegate.photoselection isEqualToString:@"User Pressed Button 1\n"])
    {
        picker.sourceType = UIImagePickerControllerSourceTypeSavedPhotosAlbum;

        if(appDelegate.sound == 1)
        {
            [classObj ButtonSound];
        }
    }
    ///////////////////////////////////Camera//////////////////////////////

    else if([appDelegate.photoselection isEqualToString:@"User Pressed Button 2\n"]) 
    {

        @try 
        {
            picker.sourceType = UIImagePickerControllerSourceTypeCamera;
        }
        @catch (NSException * e)
        {
            UIAlertView *av = [[UIAlertView alloc] initWithTitle:@"ALERT" 
                                                         message:@"Please try again"
                                                        delegate:self 
                                               cancelButtonTitle:nil 
                                               otherButtonTitles:@"ok", nil];
            [av show];

        }
        if(appDelegate.sound == 1)
        {
            [classObj ButtonSound];
        }
    }
    ///////////////////////////////////Cancel//////////////////////////////


    else if([appDelegate.photoselection isEqualToString:@"User Pressed Button 3\n"]) 
    {
        if(appDelegate.sound == 1)
            [classObj ButtonSound];
        return;
    }
    [self presentModalViewController:picker animated:YES];
    [picker release];
}

How can i handle this?please help after taking picture i crop the image and save in application like this:

- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingImage:(UIImage *)image editingInfo:(NSDictionary *)editingInfo {

    iRolegameAppDelegate *appDelegate = (iRolegameAppDelegate *)[[UIApplication sharedApplication]delegate];

    if(appDelegate.sound == 1)
    {
        [classObj ButtonSound];
    }

    [picker dismissModalViewControllerAnimated:YES];
    imageView.image = image;
    CGSize size = [imageView.image size];
    CGRect cropRect = CGRectMake(0.0, 0.0, size.width, size.height);

    NSValue *cropRectValue = [editingInfo objectForKey:@"UIImagePickerControllerCropRect"];
    cropRect = [cropRectValue CGRectValue];

    appDelegate.slectedimage = image; 
    imageView.hidden = YES;

    if( [appDelegate.Name length] != 0 && max_att == 15)
    {
        btnNotDone.hidden   = YES;
        btnDone.enabled = YES;
    }

    //IMAGE SAVE IN DOCUMENTS//////
    [UIImagePNGRepresentation(image) writeToFile:[self findUniqueSavePath] atomically:YES];
    // Show the current contents of the documents folder
    CFShow([[NSFileManager defaultManager] directoryContentsAtPath:[NSHomeDirectory() stringByAppendingString:@"/Documents"]]);




}

Please help me. I want to remove all warnings.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T12:15:15+00:00Added an answer on May 22, 2026 at 12:15 pm

    You’re leaking the UIImagePickerController. Autorelease it on creation or release it after dismissModalViewControllerAnimated.

    You may still get memory warnings, photos can be enormous, especially on the iPhone 4 and at a certain point you have two of them in memory: the UIImage and the autoreleased PNG.

    P.S. you don’t seem to be using size and cropRect so you could delete them.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is driving me crazy!!! I'm getting a Received memory warning. Level=1 whenever I
Can anyone help in analysing this crash issue? The program did receive memory warning
In my project I am receiving this error Received Memory Warning [level 1] I
I receive this Run-Time Check Failure upon the return in the following code. I
Just when I thought I had gotten the hang of Objective-C's memory-management this error
I receive this message (see image below) when I try to edit in debugging.
I receive a dictionary as input, and would like to to return a dictionary
I receive TypeError: Can't convert 'float' object to str implicitly while using Gambler.pot +=
I am getting Received memory warning. Level = 1 when I use UIImagePickerControllerSourceTypeCamera .
When converting PDF Pages into UIImages I receive memory warnings all the time. It

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.