I am trying to implement live camera functionality in my iPhone application and am running into trouble. Basically, the way it is structured is this: I provide a UINavigationController wherein the user can navigate to an image with a table view and (upon choosing one) a detail view.
They can then click on a button and take a new photo with the camera. Ideally, what should happen is that after taking the photo or canceling they go back to the navigation root where the images are listed again. For this, I am implementing the UIImagePickerController delegate within my main detail view controller.
All of that is implemented just fine except that last bit - I can access the photo, etc. but when attempting to return to that first listing - using popToRootViewControllerAnimated - I get an EXC_BAD_ACCESS
error. Here is a reduced version of the relevant code (didFinishPickingMediaWithInfo
... imagePickerControllerDidCancel
works the same way):
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
// Do some image processing stuff here...
[picker dismissModalViewControllerAnimated:YES];
[picker release];
[self.navigationController popToRootViewControllerAnimated:YES];
}
Commenting out that last line makes it work, but then it just goes back to the detail view with the original photo, not the listing.
Anyone?
Update: A detail I neglected to mention before... The pop does, in fact, appear to work to a degree. The camera picker is dismissed and it goes back to the listing. However, that's when the app dies (the selected table cell is still blue, from where the user tapped before). I also tried using popViewControllerAnimated
instead with the exact same result.