views:

514

answers:

1

Hi,

I have troubles using UIImagePicker to take pictures based on the "Taking Pictures with the Camera" chapter from the iPhone programming guide.

Whatever i try all i get is a grey/white screen.

here is my code :

- (void)viewDidLoad {
    [super viewDidLoad];

    UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init];
    imagePicker.delegate = self;
    imagePicker.sourceType = UIImagePickerControllerSourceTypeCamera;
    imagePicker.allowsEditing = NO;
    [self presentModalViewController:imagePicker animated:YES];
}

I've tried to call the imagePicker from the viewDidLoad, viewWillAppear or awakeFromNib, nothing changes.

My viewController implements UINavigationControllerDelegate and UIImagePickerControllerDelegate.

I'm running this on OS3.1 on a first gen iPhone.

Any help would be greatly appreciated ! Thanks, Vincent.

+1  A: 

I would placing that call in viewDidAppear as oposed to viewDidLoad.

IphoneDev