3

群衆の知恵を試してみたい..私は今イライラしているので. 前もって感謝します。

だからここに私のコードがあります:

- (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 *エラー; if ([filemgr copyItemAtPath:[info objectForKey:@"UIImagePickerControllerMediaURL"] toPath:newFilename error:&err] == YES) NSLog (@"移動成功"); else 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
4

1 に答える 1

0

私はあなたの論理に従うことができますが、根本的な問題が 1 つあります。これは、動画を保存する方法ではありません

関連するエラー チェックを行わない大まかな例を以下に示します。

(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info

{

    .... code here .....

    NSString* videoURL= [info objectForKey:UIImagePickerControllerMediaURL];

    //remember to test that the video is compatible for saving to the photos album

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

    .... code here .....

}
于 2010-07-21T07:05:47.480 に答える