UISaveVideoAtPathToSavedPhotosAlbum 崩溃
我有一个处于视频模式的 UIImagePickerController;完成录制视频并点击“使用”按钮接受视频后,我使用此方法 -(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
在其中我想将视频保存在相机胶卷中并从视频中检索第一帧以在 UIImageView 中显示它。我使用的代码如下:
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 或检索帧),则一切正常!
控制台报这个错误:
由于未捕获的异常“NSInvalidArgumentException”而终止应用程序,原因:“+[NSInitation invocateWithMethodSignature:]:方法签名参数不能为 nil”
有什么想法吗?谢谢...
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
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:
didFinishPickingMediaWithInfo:(NSDictionary *)info
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...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在你的课堂上,你是否实现了以下方法?
In your class, do you implement the following method?