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 < 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?