我在〜/ Library/Application Support/iphone模擬器/ 4.3.2/Applications/ApplicationGUID/Documents文件夾中有.m4v視頻文件。但是我的應用程序在運行時崩潰。在NSlog中,它顯示文件路徑爲空。在iPhone模擬器中不顯示視頻
我有以下的代碼的applicationDidFinishLaunching:(UIApplication的*)應用
NSString *filePath = [NSHomeDirectory() stringByAppendingPathComponent:[NSString stringWithFormat:@"Documents/Sample_ipod.m4v"]];
NSString *videoFilepath = [[NSBundle mainBundle] pathForResource:@"VID" ofType:@"m4v"];
NSLog(@"Filepath is: %@", videoFilepath);
UISaveVideoAtPathToSavedPhotosAlbum(filePath, self, @selector(video:didFinishSavingWithError:contextInfo:), nil);
imagePickerController.delegate = self;
imagePickerController.sourceType =
UIImagePickerControllerSourceTypePhotoLibrary;
imagePickerController.mediaTypes = [UIImagePickerController availableMediaTypesForSourceType:UIImagePickerControllerSourceTypePhotoLibrary];
[window addSubview:imagePickerController.view];
感謝Paul。我已經更新了我的代碼,但它仍然崩潰,它給出了以下error2011- 10-12 11:19:29.258 ios視頻電子郵件[46729:b303]文件路徑是:(空) 2011-10-12 11:19:32.219 ios視頻電子郵件[46729:b303] ***終止應用程序由於未捕獲的異常'NSInvalidArgumentException',原因:'+ [NSInvocation invocationWithMethodSignature:]:方法簽名參數不能爲零' – user973637
好吧,現在我可以獲取文件路徑。 (視頻:didFinishSavingWithError:contextInfo :),無); – user973637
2011-10-12 11:36:28.323 IOS視頻電子郵件[46885:B303] filepath是:/用戶/ jonathanchen /庫/應用程序支持/ IPHON e Simulator/4.3.2/Applications/44B36E70-3EAE-4275-BA15-55B7E16AA25F/Documents/sample_ipod.m4v 2011-10-12 11:36:29.671 ios video email [46885:b303] ***終止應用程序由於未捕獲的異常'NSInvalidArgumentException',原因:'+ [NSInvocation invocationWithMethodSignature:]:方法簽名參數不能爲零' – user973637