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 9143057
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T09:55:47+00:00 2026-06-17T09:55:47+00:00

My App crashes saying Received Memory Warning when i take a picture from camera

  • 0

My App crashes saying “Received Memory Warning” when i take a picture from camera (UIImagePickerController).

Scenario when i get the crash: If I have other apps running on my device(2 or more), I am getting the crash and if there is only one other app running or no other apps running before I launch my app then there are no crashes at all.

This crash happens only when i take the picture from my camera but when i choose the picture from photo library there is no crash at all.

I am using Xcode 4.3.2 and I am using ARC.

Can any one help me on this?

This is the code i am using

-(void)actionSheet:(UIActionSheet *)actionSheet didDismissWithButtonIndex: (NSInteger)buttonIndex 
{

    if (buttonIndex < 2) 
    {
        if([UIImagePickerController isSourceTypeAvailable:buttonIndex==0?UIImagePickerControllerSourceTypeCamera:UIImagePickerControllerSourceTypePhotoLibrary])
        {
            UIImagePickerController *ipc = [[UIImagePickerController alloc] init];
            [ipc setDelegate:(id<UIImagePickerControllerDelegate,UINavigationControllerDelegate>) self];
            [ipc setSourceType:buttonIndex==0?UIImagePickerControllerSourceTypeCamera:UIImagePickerControllerSourceTypePhotoLibrary];
            if (buttonIndex == 0) 
            {
                [ipc setAllowsEditing:NO];
            }
            [ipc setMediaTypes:[NSArray arrayWithObjects:(NSString *)kUTTypeImage, nil]];
            [self presentModalViewController:ipc animated:YES];
        }
        else 
        {
            UIAlertView* alert = [[UIAlertView alloc] initWithTitle:@"Action Alert" message:@"Camera is not available in this device." delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
            [alert show];
        }
    }
}



    -(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
    {

        [self dismissModalViewControllerAnimated:YES];
        UIImage *image = [info objectForKey:UIImagePickerControllerEditedImage];
        if (!image) image = [info objectForKey:UIImagePickerControllerOriginalImage];
        [NSThread detachNewThreadSelector:@selector(scallImage:) toTarget:self withObject:image];
}




 -(void) scallImage:(UIImage *) image
    {
    CGSize newSize = CGSizeMake(320, 480);
    UIGraphicsBeginImageContext(newSize);
    [image drawInRect:CGRectMake(0, 0, newSize.width, newSize.height)];
    image=nil;
    UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();
    NSString *cImage = [UIImageJPEGRepresentation(newImage, 0.5) base64EncodedString];
    [ImageButton setBackgroundImage:newImage forState:UIControlStateNormal];
    [ImageButton setHidden:NO];
    //[profileImageButton setBackgroundImage:newImage forState:UIControlStateNormal];
    newImage=nil;
}

Is there any thing wrong in my code?

  • 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-06-17T09:55:48+00:00Added an answer on June 17, 2026 at 9:55 am

    I finally realized that by removing some of the unwanted images/resources from the project I am able to run my app without crashes …!!! Thanks everyone who helped me !

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

Sidebar

Related Questions

I received a crash report from a user saying the application crashes when it
When my app crashes, I get a crash report that takes 5 minutes to
I got a support email from a customer saying his app crashes when it
I have noticed in my adobe air app that I get intermitent crashes while
my app crashes when the user tries to delete a row from the UITableView
my iphone app crashes unexpectedly and looking at the crash log I can't tell
Does a destructor get called if the app crashes? If it's an unhandled exception
My app crashes when I try to use the features of b2Body from within
Retrieving a value from standardUserDefaults using integerForKey after saving with setInteger:forKey always crashes app.
What I need it to have it once the app stops reciving text from

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.