NSInvalidArgumentException – 当我尝试将捕获的视频复制到文档文件夹时应用程序终止
我想尝试一下群众的智慧……因为我现在很沮丧。 提前致谢。
所以这是我的代码:
- (void)imagePickerController:(UIImagePickerController *)ipc didFinishPickingMediaWithInfo:(NSDictionary *)info{
NSLog(@"info: %@",info);
NSString *newFilename = [NSString stringWithFormat:@"%@/%@.mov", [NSHomeDirectory() stringByAppendingPathComponent:@"文档"], [NSString stringWithFormat:@"%d", (long)[[NSDate date] timeIntervalSince1970]]];
NSLog(@"newFilename: %@",newFilename);
NSFileManager *filemgr = [NSFileManager defaultManager];
NSError *错误; if ([filemgr copyItemAtPath:[info objectForKey:@"UIImagePickerControllerMediaURL"] toPath:newFilename 错误:&err] == YES) NSLog(@"移动成功"); 别的 NSLog(@"移动失败");
这是日志:
2010-05-16 18:19:01.975 erlkoenig[7099:307] info: {
UIImagePickerControllerMediaType = "public.movie";
UIImagePickerControllerMediaURL = "file://localhost/private/var/mobile/Applications/BE25F9B5-2D08-4B59-8B62-D04DF7BB7E5B/tmp/-Tmp-/capture-T0x108cb0.tmp.8M81HU/capturedvideo.MOV";
}
newFilename: /var/mobile/Applications/BE25F9B5-2D08-4B59-8B62-D04DF7BB7E5B/Documents/1274026741.mov
[NSURL fileSystemRepresentation]: unrecognized selector sent to instance 0x1c1f90
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSURL fileSystemRepresentation]: unrecognized selector sent to instance 0x1c1f90
I'd like to try the wisdom of the crowds..because i'm frustrated right now.
Thanks in advance.
So here is my code:
- (void)imagePickerController:(UIImagePickerController *)ipc didFinishPickingMediaWithInfo:(NSDictionary *)info{
NSLog(@"info: %@",info);
NSString *newFilename = [NSString stringWithFormat:@"%@/%@.mov",
[NSHomeDirectory() stringByAppendingPathComponent:@"Documents"],
[NSString stringWithFormat:@"%d", (long)[[NSDate date] timeIntervalSince1970]]];
NSLog(@"newFilename: %@",newFilename);
NSFileManager *filemgr = [NSFileManager defaultManager];
NSError *err;
if ([filemgr copyItemAtPath:[info objectForKey:@"UIImagePickerControllerMediaURL"] toPath:newFilename error:&err] == YES)
NSLog (@"Move successful");
else
NSLog (@"Move failed");
and this is the log:
2010-05-16 18:19:01.975 erlkoenig[7099:307] info: {
UIImagePickerControllerMediaType = "public.movie";
UIImagePickerControllerMediaURL = "file://localhost/private/var/mobile/Applications/BE25F9B5-2D08-4B59-8B62-D04DF7BB7E5B/tmp/-Tmp-/capture-T0x108cb0.tmp.8M81HU/capturedvideo.MOV";
}
newFilename: /var/mobile/Applications/BE25F9B5-2D08-4B59-8B62-D04DF7BB7E5B/Documents/1274026741.mov
[NSURL fileSystemRepresentation]: unrecognized selector sent to instance 0x1c1f90
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSURL fileSystemRepresentation]: unrecognized selector sent to instance 0x1c1f90
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我可以遵循您的逻辑,但有一个基本问题:这不是保存视频的方式。
请看下面的一个粗略示例,没有进行相关的错误检查。
I can follow you logic but have one fundamental issue: this is not how you save video.
Please see a rough example below without the relevant error checking.