0

NOTE: This issue was related to XCode. The original question is in place, however the title has been updated to reflect the actual problem.

I'm using a table view for form input and I have created a sort of library for adding input fields to my table. Once on the input fields I need is an image capture field that initiates the device camera.

I have declared the interface as follows.

@interface PhotoBlockCell : UITableViewCell &lt UINavigationControllerDelegate, UIImagePickerControllerDelegate > 

To initiate image capture, I have a delegate pointing back to the parent view controller that houses my table view. I launch the device camera using a UIImagePickerController as follows.

- (IBAction)addPhoto:(id)sender{
    if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera] == YES){
        if ([sender isKindOfClass:[UIButton class]])
             activeButton = (UIButton*)sender;
        UIImagePickerController * imagePicker = [[UIImagePickerController alloc] init];
        imagePicker.sourceType = UIImagePickerControllerSourceTypeCamera;
        imagePicker.delegate = self;
        [self.delegate presentModalViewController:imagePicker animated:YES];
    }
}

This launches the device camera without issue, but I can't seem to capture the resulting photo. Adding breakpoints seems to indicate that my didFinishPickingMediaWithInfo never triggers.

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

    // button 1
    if (activeButton == button1) {
        photo1 = [info objectForKey:@"UIImagePickerControllerOriginalImage"];
    }

    // dismiss the picker
    [picker dismissModalViewControllerAnimated:YES];
}

The view controller is being dismissed, however. Any ideas what the issue might be?

Jason George
  • 6,992
  • 8
  • 44
  • 60

1 Answers1

0

Apparently this was working all along and the issue was related to a recent upgrade from XCode 4.2 to 4.3 (I was forced to upgrade today after upgrading my phone to 5.1). It seems some flag internal to my device was preventing breaking/logging while debugging. A manual pause cleared it up.

I followed instructions here to resolve the issue.

  1. Pause the app using the pause button in XCode.
  2. Add a new break point and continue
  3. Continue after breaking at the new break point.
Community
  • 1
  • 1
Jason George
  • 6,992
  • 8
  • 44
  • 60