如何删除存储在文档文件夹中的视频?

时间:2010-04-28 13:59:30

标签: iphone cocoa-touch iphone-sdk-3.0

我已将视频存储在文档文件夹中。路径是

/Users/sridhar/Library/Application Support/iPhone Simulator/User/Applications/EC177E77-8665-485C-93DE-62350FA6D0E7/Documents/air.mp4   

我想删除该视频。我怎么能以编程方式做到这一点。

1 个答案:

答案 0 :(得分:1)

应该有效:

NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); 
NSString *documentsDirectory = [paths objectAtIndex:0]; 
NSString *filePath = [documentsDirectory stringByAppendingPathComponent:@"air.mp4"];
BOOL succeed = [[NSFileManager defaultManager] removeItemAtPath:filePath error:nil];