2012-02-09 94 views
1

我在視頻模式下有一個UIImagePickerController;當我完成錄製視頻後,點擊「使用」按鈕接受視頻,我使用這種方法-(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info並在裏面我想保存視頻的相機膠捲,並從視頻檢索第一幀,以顯示它在UIImageView。我使用的代碼如下:UISaveVideoAtPathToSavedPhotosAlbum crash

 
    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]; 

的問題是,如果我添加的方法UISaveVideoAtPathToSavedPhotosAlbum的應用程序崩潰。

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

其中tmpFilePath與我上面使用的相同。

相反,如果我只使用此操作之一(UISaveVideoAtPathToSavedPhotosAlbum或檢索框架)一切正常!

控制檯報告這個錯誤:

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

任何想法?謝謝...

回答

5

在你的課堂上,你是否實現了以下方法?

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

Ops ...我忘了它。我會試一試。 – Fry 2012-02-09 14:09:21

+0

非常感謝。現在完美的作品! – Fry 2012-02-09 14:10:55