我試圖從文檔目錄中刪除視頻,但視頻並未刪除。從文檔目錄中刪除視頻的問題
這裏是我正在試圖刪除視頻:
//Delete Video
NSError *error = nil;
//NSData *videoData = [NSData dataWithContentsOfURL:self.finalURL];
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *tempPath = [documentsDirectory stringByAppendingFormat:@"/vid1.mp4"];
[[NSFileManager defaultManager] removeItemAtPath: tempPath error: &error];
UIAlertView *removeSuccessFulAlert=[[UIAlertView alloc]initWithTitle:@"Congratulation:" message:@"Successfully removed" delegate:self cancelButtonTitle:@"Close" otherButtonTitles:nil];
[removeSuccessFulAlert show];
好了,所以這個記錄'從路徑在/ var /移動刪除項/了Applica錯誤tions/E5532C71-82BD-4348-AB5E-002A14C975B3/Documents/vid1.mp4 is操作無法完成。 (可可錯誤4.)' – matthew
@matthew你確定電影文件存在嗎? – chancyWu
所以我修復了這個錯誤。唯一的問題是,當我刪除視頻時,應用程序佔用的空間量會下降,但不會一直到視頻拍攝之前的位置。所以它從18開始,然後當一個視頻被拍攝時,它會到56,但是當被刪除時,它只會下降到20,而不是所有的方式回到18. – matthew