NSInvalidArgumentException – App terminates while i'm trying to copy a captured video to documents f
- by ChrNis
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