1
votes

I've a UIImagePickerController in video mode; after I finish recording video and I tap on "Use" button to accept the video I use this method -(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info and inside it i want save the video in camera roll and retrieve the first frame from the video to show it in UIImageView. The code that I use is the following:

    NSString *tempFilePath = [[info objectForKey:UIImagePickerControllerMediaURL] path];
    NSURL *url = [NSURL fileURLWithPath:tempFilePath];
            
    MPMoviePlayerController *moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:url];
    moviePlayer.shouldAutoplay = NO;
    imageView.image = [moviePlayer thumbnailImageAtTime:0.0 timeOption:MPMovieTimeOptionNearestKeyFrame];

The problem is that if I add the method UISaveVideoAtPathToSavedPhotosAlbum the app crash.

UISaveVideoAtPathToSavedPhotosAlbum(tempFilePath, self,  @selector(video:didFinishSavingWithError:contextInfo:), nil);

where tmpFilePath is the same that I used above.

Instead if I use only one of this operation (UISaveVideoAtPathToSavedPhotosAlbum or retrieve frame) all work fine !

The console report this error:

Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '+[NSInvocation invocationWithMethodSignature:]: method signature argument cannot be nil'

Any ideas ? Thanks...

1

1 Answers

5
votes

In your class, do you implement the following method?

- (void)video:(NSString *)videoPath didFinishSavingWithError:(NSError *)error contextInfo:(void *)contextInfo {