iPhone: UIImagePickerController Randomly Fails to Take Picture
Posted
by pion
on Stack Overflow
See other posts from Stack Overflow
or by pion
Published on 2010-04-11T20:52:14Z
Indexed on
2010/04/11
21:23 UTC
Read the original article
Hit count: 476
iphone
|uiimagepickercontroller
I use a UIPickerViewController to take picture. It works 80% but seemingly at random it fails to take a picture. In tracing the code I found out that it occasionally goes to
-PinRecordNewTableViewController:viewDidUnload.
That is where it fails because it set nil to all ivars.
@interface PinRecordNewTableViewController : UITableViewController {
}
...
@implementation PinRecordNewTableViewController
...
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
...
PinRecordNewPicture *pinRecordNewPicture = [[PinRecordNewPicture alloc] initWithNibName:@"PinRecordNewPicture" bundle:nil];
pinRecordNewPicture.delegate = self;
[self.navigationController pushViewController:pinRecordNewPicture animated:YES];
[pinRecordNewPicture release];
...
}
@interface PinRecordNewPicture : UIViewController
...
@implementation PinRecordNewPicture
...
- (void)picturePicker:(UIImagePickerControllerSourceType)theSource {
UIImagePickerController *picker = [[UIImagePickerController alloc] init];
picker.delegate = self;
picker.sourceType = theSource;
picker.allowsEditing = YES;
[self presentModalViewController:picker animated:YES];
[picker release];
}
- (IBAction) takePicture:(id)sender {
UIImagePickerControllerSourceType source = UIImagePickerControllerSourceTypeCamera;
if ([UIImagePickerController isSourceTypeAvailable:source]) {
[self picturePicker:source];
}
What did I do wrong? Did I miss something that causes it to behave "randomly"?
Thanks in advance for your help.
© Stack Overflow or respective owner