0

I am using UIImage Picker but the delegate is not called.

- (IBAction)captureVideo:(id)sender {
    self.imgPicker = [[UIImagePickerController alloc] init];
    self.imgPicker.allowsImageEditing = YES;
    self.imgPicker.delegate = self;
    /* if we want from the library*/
    self.imgPicker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
    self.imgPicker.mediaTypes = [[NSArray alloc] initWithObjects: (NSString *) kUTTypeMovie, nil];

    [self performSelector:@selector(takePicture) withObject:self afterDelay:1.0];
// I added that after an answer I san on SO


}

-(void) takePicture
{
    [self presentModalViewController:self.imgPicker animated:YES];

}

- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingImage:(UIImage *)img editingInfo:(NSDictionary *)info {
    NSLog(@"Video chosen");
}

I added the delay as I saw in here.

I am running on a device.

Community
  • 1
  • 1
ghostrider
  • 5,131
  • 14
  • 72
  • 120

1 Answers1

1

First of all that method is deprecated in iOS 3.0, use instead:

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

Be sure also to make your interface conforms to protocol <UIImagePickerDelegate>.

Matteo Gobbi
  • 17,697
  • 3
  • 27
  • 41