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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T15:43:10+00:00 2026-05-25T15:43:10+00:00

Can any one help me with this problem? As in my last question, I

  • 0

Can any one help me with this problem?

As in my last question, I am using a tabBarController with 3 tab items. The 3rd tab is has a uiViewController with a UIImagePickerController in it(a camera).

now every things is working except from one thing. When take an image with the camera and pressing “use” i am getting the alert the the image was save and i can see it in the photo album (if i close the app and look at it) but the app get stuck at this poing and i can not do anything any more. I can see the image on the screen and the “use” and “retake” buttons are not usable. just stuck like that.

Can any one see what am i doing wrong over here?

ps. In all of the examples and tutorials i found there is a release of the picker in the cancel…(also in my code). The picker in my case is a property of the view controller (imgPicker) and i release it as always in the dealloc method, Is that write or wrong? should i live it like that or am i doing a bad memory thing over here (I am not getting any “bad memory error” over here but it might be my mistake…)?

I load the UIImagePicker in the viveWillAppear delegate method.
Every thing is in the same TakePhotoViewController.m file…

-(void) viewWillAppear:(BOOL)animated{
    self.imgPicker = [[UIImagePickerController alloc] init];
    self.imgPicker.allowsEditing = NO;
    self.imgPicker.delegate = self;
    self.imgPicker.sourceType = UIImagePickerControllerSourceTypeCamera;
    [self presentModalViewController:imgPicker animated:YES];  
}

and the delegate methods:

#pragma mark -
#pragma mark - UIImagePicker delegate methods

//saving the image that was taken
- (void) imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo: (NSDictionary *)info
{
    // Access the uncropped image from info dictionary
    UIImage *image = [info objectForKey:@"UIImagePickerControllerOriginalImage"];

    // Save image
    UIImageWriteToSavedPhotosAlbum(image, self, @selector(image:didFinishSavingWithError:contextInfo:), nil);

    [picker release];
}

//alerting the user if the images was saved or not
- (void)image:(UIImage *)image didFinishSavingWithError:(NSError *)error contextInfo:(void *)contextInfo
{
    UIAlertView *alert;

    // Unable to save the image  
    if (error)
        alert = [[UIAlertView alloc] initWithTitle:@"Error" 
                                       message:@"Unable to save image to Photo Album." 
                                      delegate:self cancelButtonTitle:@"Ok" 
                             otherButtonTitles:nil];
    else // All is well
        alert = [[UIAlertView alloc] initWithTitle:@"Success" 
                                       message:@"Image saved to Photo Album." 
                                      delegate:self cancelButtonTitle:@"Ok" 
                             otherButtonTitles:nil];
    [alert show];
    [alert release];
}

//if user is cancelling the camera
-(void)imagePickerControllerDidCancel:(UIImagePickerController *)picker
{
    [[picker parentViewController] dismissModalViewControllerAnimated:YES];
    [self.tabBarController setSelectedIndex:0];
}

Thank you very much,
Erez

  • 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-25T15:43:11+00:00Added an answer on May 25, 2026 at 3:43 pm

    You’re on the right track with the Cancel Action, but failed to do it for the other actions:

    You need to call dismiss on ViewController after each action.

    http://developer.apple.com/library/ios/#DOCUMENTATION/UIKit/Reference/UIImagePickerController_Class/UIImagePickerController/UIImagePickerController.html

    EDIT: New link https://developer.apple.com/library/ios/#documentation/UIKit/Reference/UIImagePickerController_Class/UIImagePickerController/UIImagePickerController.html#//apple_ref/doc/uid/TP40007070

    … However, if you set this property to YES, your delegate must dismiss
    the image picker interface after the user takes one picture or cancels
    the operation.

    So, if you need to take more than 1 picture, showCameraControls needs to be set to NO, and you need to use your own CameraOverlayView.

    Also, definitely DO NOT release picker in your delegate! When the ViewController pops the view, it will release it automatically (Assuming that the picker is not being retained elsewhere). Rule of thumb, if you don’t own (retain) it, don’t release it. (This concept will probably be forgotten once iOS5 ARC is commonplace)

    You should probably release the ViewController after it has been presented.

    iPhone – modalViewController release

    EDIT: more code to help

    -(void) viewWillAppear:(BOOL)animated{
        // No need to store... this is 1 use only anyway. Save memory, and release it when done.
        UIImagePickerController *imgPicker = [[UIImagePickerController alloc] init];
        imgPicker.allowsEditing = NO;
        imgPicker.delegate = self;
        imgPicker.sourceType = UIImagePickerControllerSourceTypeCamera;
    
        [self presentModalViewController:imgPicker animated:YES];
        [imgPicker release]; // Release this here, this will execute when modal view is popped. 
    }
    

    Delegate:

    - (void) imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo: (NSDictionary *)info
    {
        /* Do what you need to do then */
        [[picker parentViewController] dismissModalViewControllerAnimated:YES];
    }
    
    //alerting the user if the images was saved or not
    - (void)image:(UIImage *)image didFinishSavingWithError:(NSError *)error contextInfo:(void *)contextInfo
    {
        /* Do what you need to do then */
        [[picker parentViewController] dismissModalViewControllerAnimated:YES];
    }
    
    //if user is cancelling the camera
    -(void)imagePickerControllerDidCancel:(UIImagePickerController *)picker
    {
        /* Do what you need to do then */
        [[picker parentViewController] dismissModalViewControllerAnimated:YES];
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can anyone help me spot the problem on this PLEASE? I'm eternally grateful for
Due to a problem posting, my last question (duplicate of this) was closed. Background
I am struggling with this problem since last one week. I have obfuscated exe
Can anyone help with this... vector<unsigned int> *vVec = new vector<unsigned int>; vVec .reserve(frankReservedSpace);
Can anyone help convert this this actionscript to Objective-c? if(mcMain.y >= stage.stageHeight - mcMain.height)
Can anyone help in this php page navigation script switch on counting normal serial
Can anyone help me with this error? alt text http://abbeylegal.com/downloads/parsererror.jpg full image here It
Can anyone help me to do this in the right way?I mean.. like that
Can anyone help me getting started with this? We have a current keygen for
Can anyone help me with reversing this PHP page navigation? Current script setting shows

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.